Re: Avg performance for int8/numeric

From: Neil Conway <neilc(at)samurai(dot)com>
To: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, "eng(at)intranet(dot)greenplum(dot)com" <eng(at)intranet(dot)greenplum(dot)com>
Subject: Re: Avg performance for int8/numeric
Date: 2006-11-24 04:09:25
Message-ID: 1164341365.23622.191.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-11-24 04:18:12 Re: Avg performance for int8/numeric
Previous Message Bruce Momjian 2006-11-24 04:06:05 Re: Direct I/O issues

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-11-24 04:18:12 Re: Avg performance for int8/numeric
Previous Message Bruce Momjian 2006-11-24 04:06:05 Re: Direct I/O issues