Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: Julien Rouhaud <rjuju123@gmail.com>,
torikoshia <torikoshia@oss.nttdata.com>,
Atsushi Torikoshi <atorik@gmail.com>,
Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>,
Robert Haas <robertmhaas@gmail.com>,
Tomas Vondra <tomas.vondra@2ndquadrant.com>,
Michael Paquier <michael@paquier.xyz>,
Evgeny Efimkin <efimkin@yandex-team.ru>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-10-05T21:42:59Z
Lists: pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes: > I would like to apply this patch (I know it has been in the commitfest > since July 2019), but I have some questions about the user API. Does it > make sense to have a column in pg_stat_actvity and an option in > log_line_prefix that will be empty unless pg_stat_statements is > installed? Is there no clean way to move the query hash computation out > of pg_stat_statements and into the main code so the query id is always > visible? (Also, did we decide _not_ to make the pg_stat_statements > queryid always a positive value?) FWIW, I think this proposal is a mess. I was willing to hold my nose and have a queryId field in the internal Query struct without any solid consensus about what its semantics are and which extensions get to use it. Exposing it to end users seems like a bridge too far, though. In particular, I'm afraid that that will cause people to expect it to have consistent values across PG versions, or even just across architectures within one version. The larger picture here is that there's lots of room to doubt whether pg_stat_statements' decisions about what to ignore or include in the ID will be satisfactory to everybody. If that were not so, we'd just move the computation into core. regards, tom lane
Commits
-
Clarify description of pg_stat_statements columns
- b4deefc39b93 15.0 landed
- 3b57d5af7435 14.0 landed
-
Fix wording in description of pg_stat_statements.toplevel
- f9e6d00df029 14.0 landed
-
Mention that toplevel is part of pg_stat_statements key.
- 7531fcb1fcf5 14.0 landed
-
adjust query id feature to use pg_stat_activity.query_id
- 9660834dd8bf 14.0 landed
-
Update copyright for 2021
- ca3b37487be3 14.0 cited
-
Take the statistics collector out of the loop for monitoring backends'
- b13c9686d084 8.2.0 cited