Re: Improving avg performance for numeric

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Hadi Moshayedi <hadi(at)moshayedi(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "mark(dot)kirkwood(at)catalyst(dot)net(dot)nz" <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz>
Subject: Re: Improving avg performance for numeric
Date: 2013-07-03 06:45:27
Message-ID: CAFj8pRC44Rw2s88vF=MGdirTpo1GLRnDKZHiVj6=E0iQn+9rJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2013/3/20 Hadi Moshayedi <hadi(at)moshayedi(dot)net>:
> Hi Tom,
>
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> After thinking about that for awhile: if we pursue this type of
>> optimization, what would probably be appropriate is to add an aggregate
>> property (stored in pg_aggregate) that allows direct specification of
>> the size that the planner should assume for the aggregate's transition
>> value. We were getting away with a hardwired assumption of 8K for
>> "internal" because the existing aggregates that used that transtype all
>> had similar properties, but it was always really a band-aid not a proper
>> solution. A per-aggregate override could be useful in other cases too.
>
> Cool.
>
> I created a patch which adds an aggregate property to pg_aggregate, so
> the transition space is can be overridden. This patch doesn't contain
> the numeric optimizations. It uses "0" (meaning not-set) for all
> existing aggregates.
>
> I manual-tested it a bit, by changing this value for aggregates and
> observing the changes in plan. I also updated some docs and pg_dump.
>
> Does this look like something along the lines of what you meant?

please, can you subscribe your patch to next commitfest?

I tested this patch, and it increase performance about 20% what is
interesting. More - it allows more comfortable custom aggregates for
custom types with better hash agg support.

Regards

Pavel

>
> Thanks,
> -- Hadi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-07-03 06:45:57 Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Previous Message Simon Riggs 2013-07-03 06:28:34 Re: New regression test time