Re: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure - Mailing list pgsql-bugs

From Julien Rouhaud
Subject Re: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure
Date
Msg-id 20221027160834.uxhmt473grlpfv5x@jrouhaud
Whole thread Raw
In response to BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure
List pgsql-bugs
Hi,

On Thu, Oct 27, 2022 at 01:49:18PM +0000, PG Bug reporting form wrote:
>
> postgres=# select calls,userid,dbid,queryid,query from
> public.pg_stat_statements where query like 'select test%';
>  calls | userid | dbid  |       queryid        |      query
> -------+--------+-------+----------------------+-----------------
>      1 |     10 | 13757 | -8729651821477628722 | select test($1)
>      1 |     10 | 13757 |  1452143938866253601 | select test($1)
> (2 rows)
>
> So given the above 2 calls for the same function, there are 2 different
> queryIds generated, seemingly based on the fact that in the first case the
> parameter can be cast to integer, and in the second case it can not.
>
> I would have expected both calls to be normalized and fingerprinted to one
> and the same queryId.

Agreed, and that's actually a known problem that is currently being worked on.
You can look at
https://www.postgresql.org/message-id/flat/36e5bffe-e989-194f-85c8-06e7bc88e6f7%40amazon.com
for details about the discussion and in-progress fix.



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure
Next
From: Παναγιώτης Ρουσάλης
Date:
Subject: PostrgreSQL 15 installation