On Wed, Aug 19, 2020 at 04:19:30PM +0200, Julien Rouhaud wrote: > Similarly to other fields in pg_stat_activity, only the queryid from the top > level statements are exposed, and if the backends status isn't active then the > queryid from the last executed statements is displayed. > > Also add a %Q placeholder to include the queryid in the log_line_prefix, which > will also only expose top level statements.
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?) Also, in the doc patch: By default, query identifiers are not computed, so this field will always be null, unless an additional module that compute query identifiers, such as <xref linkend="pgstatstatements"/>, is configured. why are you saying "such as"? Isn't pg_stat_statements the only way to see the queryid? This command allowed the queryid to be displayed in pg_stat_activity: ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements'; -- Bruce Momjian <br...@momjian.us> https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee