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

pgsql: Improve contrib/pg_stat_statements to lump "similar" queriestog

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve contrib/pg_stat_statements to lump "similar" queriestog
Date: 2012-03-29 01:02:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
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

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



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

pgsql-committers by date

Next:From: Fujii MasaoDate: 2012-03-29 02:33:04
Subject: Re: Re: [COMMITTERS] pgsql: pg_test_timing utility, to measure clock monotonicity and timing
Previous:From: Peter EisentrautDate: 2012-03-28 18:14:09
Subject: pgsql: Run maintainer-check on all PO files, not only configured ones

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