Re: Eager aggregation, take 3

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Andy Fan <zhihuifan1213(at)163(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Eager aggregation, take 3
Date: 2024-07-03 08:29:27
Message-ID: CAMbWs4-LwyOg9ga+NVF7yQbMi0ZsZdN1G_sO2v=YJHV18=19+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 13, 2024 at 4:07 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> I spent some time testing this patchset and found a few more issues.
> ...

> Hence here is the v8 patchset, with fixes for all the above issues.

I found an 'ORDER/GROUP BY expression not found in targetlist' error
with this patchset, with the query below:

create table t (a boolean);

set enable_eager_aggregate to on;

explain (costs off)
select min(1) from t t1 left join t t2 on t1.a group by (not (not
t1.a)), t1.a order by t1.a;
ERROR: ORDER/GROUP BY expression not found in targetlist

This happens because the two grouping items are actually the same and
standard_qp_callback would remove one of them. The fully-processed
groupClause is kept in root->processed_groupClause. However, when
collecting grouping expressions in create_grouping_expr_infos, we are
checking parse->groupClause, which is incorrect.

The fix is straightforward: check root->processed_groupClause instead.

Here is a new rebase with this fix.

Thanks
Richard

Attachment Content-Type Size
v9-0001-Introduce-RelInfoList-structure.patch application/octet-stream 14.3 KB
v9-0002-Introduce-RelAggInfo-structure-to-store-info-for-grouped-paths.patch application/octet-stream 7.8 KB
v9-0003-Set-up-for-eager-aggregation-by-collecting-needed-infos.patch application/octet-stream 14.4 KB
v9-0004-Implement-functions-that-create-RelAggInfos-if-applicable.patch application/octet-stream 29.7 KB
v9-0005-Implement-functions-that-generate-paths-for-grouped-relations.patch application/octet-stream 13.1 KB
v9-0006-Build-grouped-relations-out-of-base-relations.patch application/octet-stream 9.0 KB
v9-0007-Build-grouped-relations-out-of-join-relations.patch application/octet-stream 27.0 KB
v9-0008-Add-test-cases.patch application/octet-stream 71.5 KB
v9-0009-Add-README.patch application/octet-stream 4.8 KB
v9-0010-Run-pgindent.patch application/octet-stream 25.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2024-07-03 08:33:44 Re: A new strategy for pull-up correlated ANY_SUBLINK
Previous Message Tom Lane 2024-07-03 08:08:59 Re: Remove last traces of HPPA support