Re: Add min and max execute statement time in pg_stat_statement - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Add min and max execute statement time in pg_stat_statement
Date
Msg-id CAM3SWZT7XCZ9SXSiW+tJvHi+SF1sygp2m1fRKnyuJFgdr0by7g@mail.gmail.com
Whole thread Raw
In response to Re: Add min and max execute statement time in pg_stat_statement  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Wed, Oct 23, 2013 at 4:34 PM, Stephen Frost <sfrost@snowman.net> wrote:
> Any chance we could accumulate into the histogram in local memory and
> only push to the shared memory on an "infrequent" or at least "less
> frequent" basis?  Apologies, I've not looked into the pg_stat_statements
> bits all that closely, but I can certainly see how having to hold it all
> in shared memory with locking to update would be painful..

I doubt it. That trick I proposed around storing the query text in an
external file is only feasible because we never update the query text,
and we hardly ever care what it actually is in practice. Contrast that
with something that is in a structure protected by a spinlock. You'd
have to keep deltas stashed in TopMemoryContext, and for all kinds of
common cases that just wouldn't work. Plus you have to have some whole
new mechanism for aggregating the stats across backends when someone
expresses an interest in seeing totals.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Add min and max execute statement time in pg_stat_statement
Next
From: Gavin Flower
Date:
Subject: Re: Add min and max execute statement time in pg_stat_statement