postgrespro/pg_wait_sampling

Queryid is always 0 with utility statements

legrandlegrand opened this issue · 2 comments

Hello,

Queryid for utility statements are 0 in pg_stat_statements until their end.
Maybe that queryid should be computed in pg_wait_sampling
using the same pgss_hash_string() function.

Regards
PAscal

Hi @legrandlegrand !

Currently pg_wait_sampling doesn't account queryId for utility statements at all (except CTAS). And this is definitely downside that have to be repaired.
Thanks for your proposal to calculate queryId for utility statements on the side of extension. It makes sense. Starting from PG14 (in particular, from commit postgres/postgres@5fd9dfa) queryId for utility statements is computed after parsing-analyze phase and for pg_wait_sampling it's enough to capture this value for further monitoring.

Fixed in v1.1.6