Re: proposal: tuplestore, tuplesort aggregate functions

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: tuplestore, tuplesort aggregate functions
Date: 2010-08-19 14:20:26
Message-ID: AANLkTimqxm-RXYC6HW1KFBYCFnZBY521CyGx8q=W61OQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/8/19 David Fetter <david(at)fetter(dot)org>:
> On Thu, Aug 19, 2010 at 12:45:13PM +0200, Pavel Stehule wrote:
>> Hello
>>
>> > I'll test both variant first. Maybe there are not any significant
>> > difference between them. Now nodeAgg can build, fill a tuplesort.
>> > So I think is natural use it. It needs only one - skip a calling a
>> > transident function and directly call final function with external
>> > tuplesort. Minimally you don't need 2x same code.
>>
>> yesterday I did a small test. Aggregates without transident
>> functions are only about 2% faster, so there has no sense thinking
>> more about them.  I'll send a patch with median and percentile
>> functions immediately - these functions are implemented like usual
>> aggregates.
>
> NTILE is already a windowing function.  Might want to check into any
> performance improvements you can give that.

The performance has to be +/- same. It is based on same technology - tuplesort.

>
> As to median, please make sure you say in detail which median you're
> using and name it so, as there is no single, authoritative median.

I searched about this. And I found so there is a different methods for
same statistic value with different names. But result has to be same.
I don't found a other median than "arithmetic" or "financial" median
(with a two derived forms - left, right median). These methods are a
different forms of some SQL - see
http://www.simple-talk.com/sql/t-sql-programming/median-workbench/ and
it is SQL related solutions. With tuplesort I can to use a simple
solution - I have a number of elements, have a sorted set and can
move to n position is set.

Next forms of median what I found are estimations.

regards

Pavel

>
> Cheers,
> David.
> --
> David Fetter <david(at)fetter(dot)org> http://fetter.org/
> Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
> Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com
> iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
>
> Remember to vote!
> Consider donating to Postgres: http://www.postgresql.org/about/donate
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Quan Zongliang 2010-08-19 14:24:54 Re: Fw: patch for pg_ctl.c to add windows service start-type
Previous Message Boxuan Zhai 2010-08-19 14:01:35 gSoC add MERGE command new patch -- merge_v104