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.vondra@2ndquadrant.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