bigsql / plprofiler

Other
79 stars 22 forks source link

plprofiler always returns "No profiling data found" even when using the command option #18

Open adithya-sama opened 4 months ago

adithya-sama commented 4 months ago

I have tried the example given in the repo and plprofiler returns "No profiling data found"

Environment: I have postgres 13 I build plprofiler from source using PGXS=1 option I have added plprofiler to shared_preload_libraries

Steps I have followed:

> pwd
> /work/plprofiler/examples

> psql
>> postgres=# CREATE DATABASE pgbench_plprofiler;
>> postgres=# CREATE DATABASE
>> postgres=# \q

> ./predb.sh
dropping old tables...
NOTICE:  table "pgbench_accounts" does not exist, skipping
NOTICE:  table "pgbench_branches" does not exist, skipping
NOTICE:  table "pgbench_history" does not exist, skipping
NOTICE:  table "pgbench_tellers" does not exist, skipping
creating tables...
generating data (client-side)...
1000000 of 1000000 tuples (100%) done (elapsed 0.67 s, remaining 0.00 s)
vacuuming...
creating primary keys...
done in 1.17 s (drop tables 0.00 s, create tables 0.01 s, client-side generate 0.70 s, vacuum 0.25 s, primary keys 0.21 s).                 CREATE FUNCTION 
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
DROP EXTENSION IF EXISTS plprofiler;
NOTICE:  extension "plprofiler" does not exist, skipping
DROP EXTENSION
CREATE EXTENSION plprofiler;
CREATE EXTENSION
DROP SEQUENCE IF EXISTS pgbench_category_seq;
NOTICE:  sequence "pgbench_category_seq" does not exist, skipping
DROP SEQUENCE
CREATE SEQUENCE pgbench_category_seq;
CREATE SEQUENCE
DROP TABLE IF EXISTS pgbench_accounts_new;
NOTICE:  table "pgbench_accounts_new" does not exist, skipping
DROP TABLE
CREATE TABLE pgbench_accounts_new (
    category    integer default (nextval('pgbench_category_seq') / 20),
        aid                     integer NOT NULL,
        bid                     integer,
        abalance        integer,
        filler          character(1000)
)
WITH (FILLFACTOR = 90);
CREATE TABLE
INSERT INTO pgbench_accounts_new
                (aid, bid, abalance, filler)
        SELECT aid, bid, abalance,
                        '11111111111111111111111111111111111111111111111111' ||
                        '11111111111111111111111111111111111111111111111111' ||
                        '22222222222222222222222222222222222222222222222222' ||
                        '22222222222222222222222222222222222222222222222222' ||
                        '33333333333333333333333333333333333333333333333333' ||
                        '33333333333333333333333333333333333333333333333333' ||
                        '44444444444444444444444444444444444444444444444444' ||
                        '44444444444444444444444444444444444444444444444444' ||
                        '55555555555555555555555555555555555555555555555555' ||
                        '55555555555555555555555555555555555555555555555555'
        FROM pgbench_accounts;
INSERT 0 1000000
DROP TABLE pgbench_accounts;
DROP TABLE
ALTER TABLE pgbench_accounts_new RENAME TO pgbench_accounts;
ALTER TABLE
ALTER TABLE pgbench_accounts ADD CONSTRAINT pgbench_accounts_pkey
        PRIMARY KEY (category, aid);
ALTER TABLE
VACUUM FULL ANALYZE pgbench_accounts;
VACUUM

> plprofiler run --command "SELECT tpcb(1, 2, 3, -42)" -d pgbench_plprofiler --output tpcb-test1.html
SELECT tpcb(1, 2, 3, -42)
-- row1:
  tpcb: -42
----
(1 rows)
SELECT 1 (0.023 seconds)

Traceback (most recent call last):
  File "/home/doc/.pyenv/versions/3.11.4/bin/plprofiler", line 33, in <module>
    sys.exit(load_entry_point('plprofiler-client==4.2', 'console_scripts', 'plprofiler')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/doc/.pyenv/versions/3.11.4/lib/python3.11/site-packages/plprofiler_client-4.2-py3.11.egg/plprofiler/plprofiler_tool.py", line 75, in main
    return run_command(sys.argv[2:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/doc/.pyenv/versions/3.11.4/lib/python3.11/site-packages/plprofiler_client-4.2-py3.11.egg/plprofiler/plprofiler_tool.py", line 844, in run_command
    report_data = plp.get_local_report_data(opt_name, opt_top, args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/doc/.pyenv/versions/3.11.4/lib/python3.11/site-packages/plprofiler_client-4.2-py3.11.egg/plprofiler/plprofiler.py", line 403, in get_local_report_data
    raise Exception("No profiling data found")
Exception: No profiling data found

I am running Postgres in WSL. Could that be the reason?. i didnt have any errors while building or loading plprofiler.