BUG: pg_stat_statements query normalization issues with combined queries

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: BUG: pg_stat_statements query normalization issues with combined queries
Date: 2016-12-20 08:40:29
Message-ID: alpine.DEB.2.20.1612200926310.29821@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello,

While investigating a performance issue, I tried to get informations from
pg_stat_statements, however I ran into another issue: it seems that when
using combined queries pg_stat_statements query normalization does not
work properly... 2 queries that should have been mapped to only one are
instead map to... 3 cases, as constants are not all ignored:

query

BEGIN ; +
SELECT data FROM Stuff WHERE id = 1 ; +
SELECT data FROM Stuff WHERE id = 2 ; +
SELECT data FROM Stuff WHERE id = 3 ; +
COMMIT;

BEGIN ; +
SELECT data FROM Stuff WHERE id = 4 ; +
SELECT data FROM Stuff WHERE id = 5 ; +
SELECT data FROM Stuff WHERE id = 6 ; +
COMMIT;

BEGIN ; +
SELECT data FROM Stuff WHERE id = ? +
SELECT data FROM Stuff WHERE id = 2 +
SELECT data FROM Stuff WHERE id = 3 +
COMMIT;

I was expecting the 2 combined queries either to be separated in
individual queries "SELECT data FROM Stuff WHERE id = ?" or in one large
queries with three ?, but not the above result...

--
Fabien

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2016-12-20 08:43:14 Re: Logical Replication WIP
Previous Message Andres Freund 2016-12-20 08:28:47 Re: increasing the default WAL segment size