Re: query_id, pg_stat_activity, extended query protocol

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>, "Imseih (AWS), Sami" <simseih(at)amazon(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-10 01:20:01
Message-ID: F001F959-400F-41C6-9886-C9665A4DE0A3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> >> I think the testing discussion should be moved to a different thread.
> >> What do you think?
> > See v4.
> >
> > 0001 deals with reporting queryId in exec_execute_message and
> > exec_bind_message.
> > 0002 deals with reporting queryId after a cache invalidation.
> >
> > There are no tests as this requires more discussion in a separate thread(?)
> At first, these patches look good.
> But I have a feeling of some mess here:
> queryId should be initialised at the top-level query. At the same time,
> the RevalidateCachedQuery routine can change this value in the case of
> the query tree re-validation.
> You can say that this routine can't be called from a non-top-level query
> right now, except SPI. Yes, but what about extensions or future usage?

This is a valid point. RevalidatePlanCache is forcing a
new queryId to be advertised ( 'true' as the second argument to
pgstat_report_query_id) . This means,
v4-0002-Report-new-queryId-after-plancache-re-validation.patch
will result in a non top-level queryId being advertised.

See the attached test case.

I need to think about this a bit.

--
Sami

Attachment Content-Type Size
test_revalidate_cache.txt text/plain 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-09-10 01:34:24 Re: Introduce XID age and inactive timeout based replication slot invalidation
Previous Message Michael Paquier 2024-09-10 00:42:31 Re: Partitioned tables and [un]loggedness