This has been saved for the 8.3 release:


Mark Kirkwood wrote:
> Avg performance for these two datatypes can be improved by *not* 
> calculating the sum of squares in the shared accumulator 
> (do_numeric_accum). However there is a little subtlety as this function 
> is also the shared by variance and stddev!
> This patch:
> - Modifies do_numeric_accum to have an extra bool parameter and does not 
> calc sumX2 when it is false.
> - Amends all the accumulators that call it to include the bool (set to 
> true).
> - Adds new functions [int8|numeric]_avg_accum that call do_numeric_accum 
> with the bool set to false.
> - Amends the the bootstrap entries for pg_aggregate to use the new 
> accumulators for avg(int8|numeric).
> - Adds the new accumulators into the bootstrap entries for pg_proc.
> Performance gain is approx 33% (it is still slower than doing sum/count 
> - possibly due to the construct/deconstruct overhead of the numeric 
> transition array).
> Cheers
> Mark

> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to [EMAIL PROTECTED] so that your
>        message can get through to the mailing list cleanly

  Bruce Momjian   [EMAIL PROTECTED]

  + If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at


Reply via email to