Re: Fix up grouping sets reorder

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Richard Guo <riguo(at)pivotal(dot)io>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Fix up grouping sets reorder
Date: 2019-06-30 23:00:33
Message-ID: 877e92r8dc.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Richard" == Richard Guo <riguo(at)pivotal(dot)io> writes:

Richard> Hi all,

Richard> During the reorder of grouping sets into correct prefix order,
Richard> if only one aggregation pass is needed, we follow the order of
Richard> the ORDER BY clause to the extent possible, to minimize the
Richard> chance that we add unnecessary sorts. This is implemented in
Richard> preprocess_grouping_sets --> reorder_grouping_sets.

Richard> However, current codes fail to do that.

You're correct, thanks for the report.

Your fix works, but I prefer to refactor the conditional logic slightly
instead, removing the outer if{}. So I didn't use your exact patch in
the fix I just committed.

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2019-07-01 00:04:47 RE: [bug fix] Produce a crash dump before main() on Windows
Previous Message Tom Lane 2019-06-30 21:30:09 Re: Dead encoding conversion functions