Re: Trouble with hashagg spill I/O pattern and costing

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, HeikkiLinnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: Trouble with hashagg spill I/O pattern and costing
Date: 2020-05-27 01:42:50
Message-ID: CAAKRu_YNGQ-zw9rpXGtYhURMqdPk+HnMa+Wj-tnNx9cwENgDxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 26, 2020 at 5:40 PM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:

> On Tue, 2020-05-26 at 21:15 +0200, Tomas Vondra wrote:
> >
> > As for the tlist fix, I think that's mostly ready too - the one thing
> > we
> > should do is probably only doing it for AGG_HASHED. For AGG_SORTED
> > it's
> > not really necessary.
>
> Melanie previously posted a patch to avoid spilling unneeded columns,
> but it introduced more code:
>
>
>
> https://www.postgresql.org/message-id/CAAKRu_aefEsv+UkQWqu+ioEnoiL2LJu9Diuh9BR8MbyXuZ0j4A@mail.gmail.com
>
> and it seems that Heikki also looked at it. Perhaps we should get an
> acknowledgement from one of them that your one-line change is the right
> approach?
>
>
I spent some time looking at it today, and, it turns out I was wrong.

I thought that there was a case I had found where CP_SMALL_TLIST did not
eliminate as many columns as could be eliminated for the purposes of
spilling, but, that turned out not to be the case.

I changed CP_LABEL_TLIST to CP_SMALL_TLIST in
create_groupingsets_plan(), create_agg_plan(), etc and tried a bunch of
different queries and this 2-3 line change worked for all the cases I
tried. Is that where you made the change?
And then are you proposing to set it based on the aggstrategy to either
CP_LABEL_TLIST or CP_SMALL_TLIST here?

--
Melanie Plageman

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-05-27 01:46:27 Re: max_slot_wal_keep_size comment in postgresql.conf
Previous Message Tom Lane 2020-05-27 01:30:21 Re: hash join error improvement (old)