>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>> Initial tests suggest that your version is ~40% slower than ours on>> some workloads.
Tom> I poked at this a bit with perf and oprofile, and concluded thatTom> probably the difference comes from
ordered_set_startup()Tom>repeating lookups for each group that could be done just onceTom> per query.
Retesting with your changes shows that the gap is down to 15% but still
present:
work_mem=64MB enable_hashagg=off (for baseline test)
baseline query (333ms on both versions):
select count(*) from (select j from generate_series(1,3) i, generate_series(1,100000) j group by j)
s;
test query:
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;
On the original patch as supplied: 571ms - 333ms = 238ms
On current master: 607ms - 333ms = 274ms
Furthermore, I can't help noticing that the increased complexity has
now pretty much negated your original arguments for moving so much of
the work out of nodeAgg.c.
--
Andrew (irc:RhodiumToad)