]> granicus.if.org Git - postgresql/commit
Improve management of "sticky" entries in contrib/pg_stat_statements.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Apr 2012 19:49:47 +0000 (15:49 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Apr 2012 19:49:47 +0000 (15:49 -0400)
commitd5375491f8e391224b48e4bb449995a4642183ea
tree47c02e82b2379f7d7fdfc8a71f535119df775d0a
parent03529a3ff999b0e4770b3e0b8e342400e383db98
Improve management of "sticky" entries in contrib/pg_stat_statements.

This patch addresses a deficiency in the previous pg_stat_statements patch.
We want to give sticky entries an initial "usage" factor high enough that
they probably will stick around until their query is completed.  However,
if the query never completes (eg it gets an error during execution), the
entry shouldn't persist indefinitely.  Manage this by starting out with
a usage setting equal to the (approximate) median usage value within the
whole hashtable, but decaying the value much more aggressively than we
do for normal entries.

Peter Geoghegan
contrib/pg_stat_statements/pg_stat_statements.c