Re: WITHIN GROUP patch

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: WITHIN GROUP patch
Date: 2013-12-28 12:04:51
Message-ID: 8738ldjimk.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> I've committed this after significant editorialization --- most
Tom> notably, I pushed control of the sort step into the aggregate
Tom> support functions.

Initial tests suggest that your version is ~40% slower than ours on
some workloads.

On my system, this query takes ~950ms using our dev branch of the code,
and ~1050ms on git master (using \timing in psql for timings, and taking
the best of many consecutive runs):

select count(*)
from (select percentile_disc(0.5) within group (order by i)
from generate_series(1,3) i, generate_series(1,100000) j group by j) s;

About ~700ms of that is overhead, as tested by running this query with
enable_hashagg=false:

select count(*)
from (select j
from generate_series(1,3) i, generate_series(1,100000) j group by j) s;

So your version is taking 350ms for the percentile calculations
compared to 250ms for ours.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-12-28 13:29:30 Re: [PATCH] Regression tests in windows ignore white space
Previous Message Michael Meskes 2013-12-28 11:34:14 Re: [bug fix] ECPG app crashes due to SIGBUS on SPARC Solaris