Re: [PATCHES] Avg performance for int8/numeric

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: Luke Lonergan <llonergan(at)greenplum(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Avg performance for int8/numeric
Date: 2006-11-25 05:57:51
Message-ID: 4567DB5F.9060900@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Luke Lonergan wrote:
> Mark,
>
> On 11/24/06 6:16 PM, "Mark Kirkwood" <markir(at)paradise(dot)net(dot)nz> wrote:
>
>> By way of comparison, here is the first 63 lines for:
>>
>> select sum(val2) from avgtest
>
> So, sum() is only alloc'ing 5 times for every row being processed, half of
> what avg() is doing.
>
> Seems like what we need to do is find a way to reuse the temp heaptuple
> between calls.
>
>

Yeah - and I'm *guessing* that its due to avg needing to
deconstruct/construct a 2 element numeric array every call (whereas sum
needs just a single numeric). So some delving into whether it is
construct_md_array that can re-use a heaptuple or whether we need to
look elsewhere...

Also Neil suggested investigating using a single composite type {int8,
numeric} for the {N,sum(X)} transition values. This could well be a
faster way to do this (not sure how to make it work yet... but it sounds
promising...).

Cheers

Mark

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-11-25 06:36:58 Re: dynahash API questions
Previous Message Neil Conway 2006-11-25 04:49:18 dynahash API questions

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2006-11-26 16:41:32 Re: [PATCHES] Avg performance for int8/numeric
Previous Message Luke Lonergan 2006-11-25 03:57:45 Re: [PATCHES] Avg performance for int8/numeric