Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Julien Rouhaud <rjuju123@gmail.com>
From: Julien Rouhaud <rjuju123@gmail.com>
To: Maksim Milyutin <milyutinma@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Yun Li <liyunjuanyong@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-19T14:43:31Z
Lists: pgsql-hackers
On Tue, Mar 19, 2019 at 2:45 PM Maksim Milyutin <milyutinma@gmail.com> wrote: > > But I think that enough to integrate into core the query normalization > routine and store generalized query strings (from which the queryId is > produced) in shared memory (for example, hashtable that maps queryId to > the text representation of generalized query). That's more or less how pg_stat_statements was previously behaving, and it had too many problems. Current implementation, with an external file, is a better alternative. > And activate > normalization routine and filling the table of generalized queries by > specified GUC. > > This allows to unbind extensions that require queryId from using > pg_stat_statements and consider such computing of queryId as canonical. The problem I see with this approach is that if you want a different implementation, you'll have to reimplement the in-core normalised queries saving and retrieval, but with a different set of SQL-visible functions. I don't think that's it's acceptable, unless we add a specific hook for query normalisation and queryid computing. But it isn't ideal either, as it would be a total mess if someone changes the implementation without resetting the previously saved normalised queries.
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