powa-team / powa-archivist

powa-archivist: the powa PostgreSQL extension
http://powa.readthedocs.io/
PostgreSQL License
51 stars 20 forks source link

we need to take toplevel into account in pg_stat_statements #54

Closed marco44 closed 8 months ago

marco44 commented 1 year ago

Right now, since PG14, all queries that can be ran both top level and on a different context have 2 entries, one with toplevel=true, one with toplevel=false. Of course it makes a mess of stats on those queries, as their min and max are taken from the 2 different series, so you just get absurd values.

Solution would be either to sum them or be able to collect the toplevel indicator too and separate them in the GUI (but i don't really see the point)

rjuju commented 1 year ago

Ah indeed. Apparently I already took care of properly summing data for pg_stat_kcache, which also has the same "toplevel" info but didn't think of pg_stat_statements where the same feature were merged :(

I agree that it's not useful to make a distinction and we should just sum it. Maybe we could eventually add some info in the per-query page, like different counters or just the top level / nested ratio or something, but I don't really see how it could be useful so let's not bother with that for now.

rjuju commented 1 year ago

The toplevel information has now been added in powa-archivist 4.2.0, and also taken into account into powa-web 4.2.0. After some manual I do see consistent results while without the patches I can reproduce the same absurd values.

I will do a bit more tests on older postgres / pg_stat_statements versions just to be sure and will try to release the version 4.2.0 quickly.