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-03-21 10:51:55
Message-ID: CAMbWs49E_dR0nobsExsyetpnBpHObLTsQLsEbWKQLkh0omPxNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 5, 2024 at 7:19 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> Here is another rebase, mainly to make the test cases more stable by
> adding ORDER BY clauses to the test queries. Also fixed more typos in
> passing.
>

This needs another rebase after 97d85be365. I also addressed several
issues that I identified during self-review, which include:

* In some cases GroupPathExtraData.agg_final_costs, which is the cost of
final aggregation, fails to be calculated. This can lead to bogus cost
estimation and end up with unexpected plan.

* If the cheapest partially grouped path is generated through eager
aggregation, the number of groups estimated for the final phase will be
different from the number of groups estimated for non-split aggregation.
That is to say, we should not use 'dNumGroups' for the final aggregation
in add_paths_to_grouping_rel().

* It is possible that we may generate dummy grouped join relations, and
that would trigger the Assert in make_grouped_join_rel().

* More typo fixes.

Thanks
Richard

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-03-21 10:55:46 Re: Introduce XID age and inactive timeout based replication slot invalidation
Previous Message John Naylor 2024-03-21 10:48:35 Re: [PoC] Improve dead tuple storage for lazy vacuum