powa-team / powa-web

PoWA user interface
http://powa.readthedocs.io/
73 stars 31 forks source link

Planning time is not displayed #131

Closed aleszeleny closed 3 years ago

aleszeleny commented 3 years ago

I'm using the remote setup with powa-collector. 2021-02-19_14-54_powa_plamnning_time_is_missing

I've used pg bench, but only created an ugly query to enforce some noticeable planning time. The monitored database instance and central powa database are the same versions.

powa=# select version();
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)

powa=# \dx pg_stat_kcache 
                  List of installed extensions
      Name      | Version | Schema |         Description         
----------------+---------+--------+-----------------------------
 pg_stat_kcache | 2.2.0   | public | Kernel statistics gathering
(1 row)

powa=# show pg_stat_kcache.track;
 pg_stat_kcache.track 
----------------------
 top
(1 row)

powa=# show pg_stat_kcache.track_planning;
 pg_stat_kcache.track_planning 
-------------------------------
 on
(1 row)

powa=# select plan_user_time, plan_system_time, plan_minflts, plan_reads, plan_reads_blks, plan_nvcsws, plan_nivcsws from pg_stat_kcache_detail skd where skd.datname = 'bench3' and plan_user_time is not null limit 3;
    plan_user_time     |    plan_system_time    | plan_minflts | plan_reads | plan_reads_blks | plan_nvcsws | plan_nivcsws 
-----------------------+------------------------+--------------+------------+-----------------+-------------+--------------
     5.724333000000115 |     0.3502779999999939 |        18331 |     561152 |              68 |         226 |           18
 0.0016430000000000004 | 0.00032400000000000007 |          328 |     286720 |              35 |          14 |            0
                     0 |               0.000464 |           25 |      49152 |               6 |           4 |            0
(3 rows)

The detail view itself nicely shows planning time, so might be a problem in the powa-web or collector. Hopefully, I've configured the whole stuff correctly since all other metrics are displayed as expected. Is there something I have to check before considering the issue as a bug? Thanks ales

rjuju commented 3 years ago

Hello,

I think that the root issue is that you didn't activate pg_stat_statements.track_planning, which isn't enabled by default.

The same option for pg_stat_kcache is indeed enabled by default, but the planning time time column displayed in the UI is the one retrieved from pg_stat_statements. pg_stat_kcache times are summed and displayed in the "CPU time repartition" graph, in the IO tab on the per-query page (I didn't have time yet to write the queries to display those graphs on the per-database and per-cluster pages unfortunately).

aleszeleny commented 3 years ago

Hello,

I've put in the listing above pg_stat_kcache.track_planning is enabled - otherwise, I won't be able to see plan times in select from pg_stat_kcache_detail - this was the method I've used to validate, that the planning time might be collected by powa-collector.

rjuju commented 3 years ago

I agree, but as I said the plantime you're showing in the screenshot comes from pg_stat_statements.track_planning, not pg_stat_kcache.track_planning.

aleszeleny commented 3 years ago

Hello, I'm sorry, my fault. I'll test enabling planner time on pg_stat_statememts

Thanks

Aleš Zelený

Dne pá 19. 2. 2021 18:10 uživatel Julien Rouhaud notifications@github.com napsal:

I agree, but as I said the plantime you're showing in the screenshot comes from pg_stat_statements.track_planning, not 'pg_stat_kcache.track_planning`.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/powa-team/powa-web/issues/131#issuecomment-782210408, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILJV7ZVB7C4PILGB5QDFTLS72LRJANCNFSM4X4OPAJA .

aleszeleny commented 3 years ago

I'm sorry, you are absolutely right, once pg_stat_statements.track_planning was enabled, it worked like a charm.

Kind regards Ales

rjuju commented 3 years ago

Great, thanks for the confirmation!