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

From Gavin Flower
Subject Re: Add min and max execute statement time in pg_stat_statement
Date
Msg-id 5265A0E3.8030103@archidevsys.co.nz
Whole thread Raw
In response to Re: Add min and max execute statement time in pg_stat_statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Add min and max execute statement time in pg_stat_statement  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 22/10/13 09:01, Tom Lane wrote:
> Gavin Flower <GavinFlower@archidevsys.co.nz> writes:
>>>> If we're going to extend pg_stat_statements, even more than min and max
>>>> I'd like to see the standard deviation in execution time.
>> How about the 'median', often a lot more useful than the 'arithmetic
>> mean' (which most people call the 'average').
> AFAIK, median is impossible to calculate cheaply (in particular, with
> a fixed amount of workspace).  So this apparently innocent request
> is actually moving the goalposts a long way, because the space per
> query table entry is a big concern for pg_stat_statements.
>
>             regards, tom lane
Yeah, obvious - in retrospect!  :-)

One way it could be done, but even this would consume far too much 
storage and processing power (hence totally impractical), would be to 
'simply' store a counter for each value found and increment it for each 
occurence...


Cheers,
Gavin



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Turning recovery.conf into GUCs
Next
From: Dimitri Fontaine
Date:
Subject: Re: Cube extension point support // GSoC'13