pg_wait_sampling icon indicating copy to clipboard operation
pg_wait_sampling copied to clipboard

Queryid is always 0 with utility statements

Open legrandlegrand opened this issue 7 years ago • 1 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

legrandlegrand avatar Nov 08 '18 20:11 legrandlegrand

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.

maksm90 avatar Apr 07 '22 12:04 maksm90