[HACKERS] BUG: pg_stat_statements query normalization issues with combinedqueries - Mailing list pgsql-hackers

From Fabien COELHO
Subject [HACKERS] BUG: pg_stat_statements query normalization issues with combinedqueries
Date
Msg-id alpine.DEB.2.20.1612200926310.29821@lancre
Whole thread Raw
Responses Re: [HACKERS] BUG: pg_stat_statements query normalization issueswith combined queries
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] increasing the default WAL segment size
Next
From: Petr Jelinek
Date:
Subject: Re: [HACKERS] Logical Replication WIP