Re: hashagg slowdown due to spill changes

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tv(at)fuzzy(dot)cz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Melanie Plageman <melanieplageman(at)gmail(dot)com>
Subject: Re: hashagg slowdown due to spill changes
Date: 2020-06-16 16:54:49
Message-ID: 20200616165449.qkrxzhe2tdxnjaza@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 15, 2020 at 07:38:45PM -0700, Jeff Davis wrote:
>On Mon, 2020-06-15 at 11:19 -0400, Robert Haas wrote:
>> On Mon, Jun 15, 2020 at 9:34 AM Tomas Vondra
>> <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
>> > But just reverting 4cad2534d will make this much worse, I think, as
>> > illustrated by the benchmarks I did in [1].
>>
>> I share this concern, although I do not know what we should do about
>> it.
>
>I attached an updated version of Melanie's patch, combined with the
>changes to copy only the necessary attributes to a new slot before
>spilling. There are a couple changes:
>
>* I didn't see a reason to descend into a GroupingFunc node, so I
>removed that.
>
>* I used a flag in the context rather than two separate callbacks to
>the expression walker.
>
>This patch gives the space benefits that we see on master, without the
>regression for small numbers of tuples. I saw a little bit of noise in
>my test results, but I'm pretty sure it's a win all around. It could
>use some review/cleanup though.
>

Looks reasonable. I can't redo my tests at the moment, the machine is
busy with something else. I'll give it a try over the weekend.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-06-16 17:14:11 Re: Parallel Seq Scan vs kernel read ahead
Previous Message Bruce Momjian 2020-06-16 16:54:06 Re: Transactions involving multiple postgres foreign servers, take 2