Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Hannu Krosing <hannuk(at)google(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, Atsushi Torikoshi <atorik(at)gmail(dot)com>, Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Evgeny Efimkin <efimkin(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Date: 2021-03-20 06:12:34
Message-ID: 20210320061234.lvrizayuumvgghgp@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 19, 2021 at 12:53:18PM -0400, Bruce Momjian wrote:
>
> Well, given we don't really want to support multiple query id types
> being generated or displayed, the "error out" above should fix it.
>
> Let's do this --- tell extensions to error out if the query id is
> already set, either by compute_query_id or another extension. If an
> extension wants to generate its own query id and store is internal to
> the extension, that is fine, but the server-displayed query id should be
> generated once and never overwritten by an extension.

Agreed, this will ensure that you won't dynamically change the queryid source.

We should also document that changing it requires a restart and calling
pg_stat_statements_reset() afterwards.

v19 adds some changes, plus extra documentation for pg_stat_statements about
the requirement for a queryid to be calculated, and a note that all documented
details only apply for in-core source. I'm not sure if this is still the best
place to document those details anymore though.

Attachment Content-Type Size
v19-0001-Move-pg_stat_statements-query-jumbling-to-core.patch text/x-diff 60.9 KB
v19-0002-Expose-queryid-in-pg_stat_activity-and-log_line_.patch text/x-diff 35.5 KB
v19-0003-Expose-query-identifier-in-verbose-explain.patch text/x-diff 6.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2021-03-20 06:13:03 Re: pspg pager is finished
Previous Message Etsuro Fujita 2021-03-20 05:35:51 Re: Asynchronous Append on postgres_fdw nodes.