Re: avg(int2) and avg(int8) micro-opt

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: avg(int2) and avg(int8) micro-opt
Date: 2005-04-06 08:26:36
Message-ID: 42539D3C.2000809@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway wrote:
> Yeah, there might be some others we could improve. float4_accum() and
> float8_accum() look like they could be improved pretty easily, and
> do_numeric_accum() should also be fixable with some hackery. I suppose
> it's also worth optimizing int2_sum(), int4_sum() and int8_sum().

Attached is a patch that applies the same optimization to int2_sum(),
int4_sum(), float4_accum(), and float8_accum(). It wasn't possible to
optimize do_numeric_accum() or int8_sum() since they both use numerics.
Performance gains are similar to those measured when this optimization
has been applied to similar aggregates (e.g. avg(float8) goes from about
6400 ms to about 4300 ms on my machine, for a single column of float8
and about 1 million rows).

Barring any objections, I'll apply this to HEAD tomorrow.

-Neil

Attachment Content-Type Size
more_aggregate_opt-2.patch text/x-patch 6.7 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Euler Taveira de Oliveira 2005-04-06 10:45:34 Re: DELETE ... USING
Previous Message Neil Conway 2005-04-06 07:08:30 Re: DELETE ... USING