Re: Avg performance for int8/numeric - Mailing list pgsql-patches

From Neil Conway
Subject Re: Avg performance for int8/numeric
Date
Msg-id 1164341365.23622.191.camel@localhost.localdomain
Whole thread Raw
In response to Avg performance for int8/numeric  (Mark Kirkwood <markir@paradise.net.nz>)
Responses Re: Avg performance for int8/numeric  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Avg performance for int8/numeric  (Mark Kirkwood <markir@paradise.net.nz>)
Re: Avg performance for int8/numeric  (Mark Kirkwood <markir@paradise.net.nz>)
List pgsql-patches
On Fri, 2006-11-24 at 11:08 +1300, Mark Kirkwood wrote:
> - Modifies do_numeric_accum to have an extra bool parameter and does not
> calc sumX2 when it is false.

I think it would be clearer to reorganize this function slightly, and
have only a single branch on "useSumX2". On first glance it isn't
obviously that transdatums[2] is defined (but unchanged) when useSumX2
is false.

> Performance gain is approx 33%

Nice.

> (it is still slower than doing sum/count - possibly due to the
> construct/deconstruct overhead of the numeric transition array).

This would indeed be worth profiling. If it turns out that array
overhead is significant, I wonder if we could use a composite type for
the transition variable instead. That might also make it easier to
represent the "N" value as an int8 rather than a numeric.

-Neil



pgsql-patches by date:

Previous
From: Mark Kirkwood
Date:
Subject: Avg performance for int8/numeric
Next
From: Tom Lane
Date:
Subject: Re: Avg performance for int8/numeric