Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group