From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>, "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, kaido vaikla <kaido(dot)vaikla(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: query_id, pg_stat_activity, extended query protocol |
Date: | 2024-09-12 03:11:35 |
Message-ID: | ZuJb5xCKHH0A9tMN@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Sep 11, 2024 at 09:41:58PM -0500, Sami Imseih wrote:
>> The tests in pg_stat_statements are one part I'm pretty sure is one
>> good way forward. It is not perfect, but with the psql meta-commands
>
> I played around with BackgrounsPsql. It works and gives us more flexibility
> in testing, but I think the pg_stat_statements test are good enough for this
> purpose.
>
> My only concern is this approach tests core functionality ( reporting of queryId )
> in the tests of a contrib module ( pg_stat_statements ). Is that a valid
> concern?
Do you think that we'd better replace the calls reporting the query ID
in execMain.c by some assertions on HEAD? This won't work for
ExecutorStart() because PREPARE statements (or actually EXECUTE,
e.g. I bumped on that yesterday but I don't recall which one) would
blow up on that with compute_query_id enabled. We could do something
like that in ExecutorRun() at least as that may be helpful for
extensions? An assertion would be like:
Assert(!IsQueryIdEnabled() || pgstat_get_my_query_id() != 0);
ExecutorFinish() and ExecutorEnd() are not that mandatory, so there's
a risk that this causes the backend to complain because a planner or
post-analyze hook decides to force the hand of the backend entry in an
extension. With such checks, we're telling them to just not do that.
So your point would be to force this rule within the core executor on
HEAD? I would not object to that in case we're missing more spots
with the extended query protocol, actually. That would help us detect
cases where we're still missing the query ID to be set and the
executor should know about that. The execute/fetch has been missing
for years without us being able to detect it automatically.
Note that I'm not much worried about the dependency with
pg_stat_statements. We already rely on it for query jumbling
normalization for some parse node patterns like DISCARD, and query
jumbling requires query IDs to be around. So that's not new.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey M. Borodin | 2024-09-12 04:48:57 | Re: Accept invalidation messages before the query starts inside a transaction |
Previous Message | Andy Fan | 2024-09-12 03:03:18 | Re: Extract numeric filed in JSONB more effectively |