From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: marcus.kempe@gmail.com
Subject: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure
Date: Thu, 27 Oct 2022 13:49:18 +0000
Message-ID: <17668-e25abc1f5375b095@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17668
Logged by: Marcus Kempe
Email address: marcus.kempe@gmail.com
PostgreSQL version: 14.5
Operating system: Linux
Description:
Consider the following case:
postgres=# create function test(x bigint) returns void language sql as $$
select x ;$$;
CREATE FUNCTION
postgres=# select test(1);
test
------
(1 row)
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 row)
postgres=# select test(12345678910); -- larger that INTMAX.
test
------
(1 row)
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.
This behavior was similar even before queryjumble.c was introduced in PG14.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, marcus.kempe@gmail.com
Subject: Re: BUG #17668: Query normalization generates multiple queryId:s for calls to the same procedure
In-Reply-To: <17668-e25abc1f5375b095@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox