From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tender Wang <tndrwang(at)gmail(dot)com>, Paul George <p(dot)a(dot)george19(at)gmail(dot)com>, Andy Fan <zhihuifan1213(at)163(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Eager aggregation, take 3 |
Date: | 2024-10-05 10:23:02 |
Message-ID: | CAMbWs48OS3Z0G5u3fhar1=H_ucmEcUaX0tRUNpcLQxHt=z4Y7w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 27, 2024 at 11:53 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Here is an updated version of this patch that fixes the rowcount
> estimate issue along this routine. (see set_joinpath_size.)
I have worked on inventing some heuristics to limit the planning
effort of eager aggregation. One simple yet effective approach I'm
thinking of is to consider a grouped path as NOT useful if its row
reduction ratio falls below a predefined minimum threshold. Currently
I'm using 0.5 as the threshold, but I'm open to other values.
+/* Minimum row reduction ratio at which a grouped path is considered useful */
+#define EAGER_AGGREGATE_RATIO 0.5
When deciding to generate a grouped relation for a base or join
relation, we calculate the row reduction ratio of its grouped paths.
If the ratio is less than EAGER_AGGREGATE_RATIO, we will skip
generating the grouped relation for a base relation, and will only
generate the grouped relation for a join relation if we can produce
any grouped paths by joining its input relations. In either case, we
will NOT generate any grouped paths by adding partial aggregation on
top of the non-grouped paths. This would reduce the number of grouped
paths as well as the grouped relations in many cases where eager
aggregation would not help a lot.
Thanks
Richard
Attachment | Content-Type | Size |
---|---|---|
v13-0001-Implement-Eager-Aggregation.patch | application/octet-stream | 174.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2024-10-05 11:43:29 | Re: New PostgreSQL Contributors |
Previous Message | Amit Kapila | 2024-10-05 10:20:05 | Re: BUG #18641: Logical decoding of two-phase commit fails with TOASTed default values |