Re: Add min and max execute statement time in pg_stat_statement

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Add min and max execute statement time in pg_stat_statement
Дата
Msg-id 54BED71D.4050302@dunslane.net
обсуждение исходный текст
Ответ на Re: Add min and max execute statement time in pg_stat_statement  (Arne Scheffer <arne.scheffer@uni-muenster.de>)
Ответы Re: Add min and max execute statement time in pg_stat_statement  (David G Johnston <david.g.johnston@gmail.com>)
Re: Add min and max execute statement time in pg_stat_statement  (Arne Scheffer <arne.scheffer@uni-muenster.de>)
Список pgsql-hackers
On 01/20/2015 01:26 PM, Arne Scheffer wrote:
> Interesting patch.
> I did a quick review looking only into the patch file.
>
> The "sum of variances" variable contains
> the "sum of squared differences" instead, I think.

Umm, no. It's not.
   e->counters.sum_var_time +=       (total_time - old_mean) * (total_time - e->counters.mean_time);

This is not a square that's being added. old_mean is not the same as 
e->counters.mean_time.

Since the variance is this value divided by (n - 1), AIUI, I think "sum 
of variances" isn't a bad description. I'm open to alternative suggestions.


>
> And a very minor aspect:
> The term "standard deviation" in your code stands for
> (corrected) sample standard deviation, I think,
> because you devide by n-1 instead of n to keep the
> estimator unbiased.
> How about mentioning the prefix "sample"
> to indicate this beiing the estimator?


I don't understand. I'm following pretty exactly the calculations stated 
at <http://www.johndcook.com/blog/standard_deviation/>


I'm not a statistician. Perhaps others who are more literate in 
statistics can comment on this paragraph.


>
> And I'm sure I'm missing C specifics (again)
> (or it's the reduced patch file scope),
> but you introduce sqrtd, but sqrt is called?


Good catch. Will fix.

cheers

andrew



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: B-Tree support function number 3 (strxfrm() optimization)
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: PATCH: decreasing memory needlessly consumed by array_agg