pg_wait_sampling
pg_wait_sampling copied to clipboard
Queryid is always 0 with utility statements
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 https://github.com/postgres/postgres/commit/5fd9dfa5f50e4906c35133a414ebec5b6d518493) 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.