Re: WITHIN GROUP patch - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: WITHIN GROUP patch
Date
Msg-id 8738ldjimk.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: WITHIN GROUP patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: WITHIN GROUP patch
List pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> I've committed this after significant editorialization --- mostTom> notably, I pushed control of the sort step
intothe aggregateTom> 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)



pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: [bug fix] ECPG app crashes due to SIGBUS on SPARC Solaris
Next
From: Amit Kapila
Date:
Subject: Re: [PATCH] Regression tests in windows ignore white space