pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Improve contrib/pg_stat_statements to lump "similar" queries tog
Date: Thu, 29 Mar 2012 01:02:06 +0000
Message-ID: <E1SD3kc-0003aw-BS@gemulon.postgresql.org> (raw)

Improve contrib/pg_stat_statements to lump "similar" queries together.

pg_stat_statements now hashes selected fields of the analyzed parse tree
to assign a "fingerprint" to each query, and groups all queries with the
same fingerprint into a single entry in the pg_stat_statements view.
In practice it is expected that queries with the same fingerprint will be
equivalent except for values of literal constants.  To make the display
more useful, such constants are replaced by "?" in the displayed query
strings.

This mechanism currently supports only optimizable queries (SELECT,
INSERT, UPDATE, DELETE).  Utility commands are still matched on the
basis of their literal query strings.

There remain some open questions about how to deal with utility statements
that contain optimizable queries (such as EXPLAIN and SELECT INTO) and how
to deal with expiring speculative hashtable entries that are made to save
the normalized form of a query string.  However, fixing these issues should
require only localized changes, and since there are other open patches
involving contrib/pg_stat_statements, it seems best to go ahead and commit
what we've got.

Peter Geoghegan, reviewed by Daniel Farina

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7313cc016344a5705eb3e6916d8c4ea849c57975

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 1116 +++++++++++++++++++++--
doc/src/sgml/pgstatstatements.sgml              |   48 +-
2 files changed, 1094 insertions(+), 70 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1SD3kc-0003aw-BS@gemulon.postgresql.org>
Permalink:  ../E1SD3kc-0003aw-BS@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1SD3kc-0003aw-BS@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve contrib/pg_stat_statements to lump "similar" queries tog
  In-Reply-To: <E1SD3kc-0003aw-BS@gemulon.postgresql.org>
  References: <E1SD3kc-0003aw-BS@gemulon.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