Re: Eager aggregation, take 3

Tender Wang <tndrwang@gmail.com>

From: Tender Wang <tndrwang@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Paul George <p.a.george19@gmail.com>, Andy Fan <zhihuifan1213@163.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, pgsql-hackers@lists.postgresql.org
Date: 2024-08-29T03:38:11Z
Lists: pgsql-hackers
Richard Guo <guofenglinux@gmail.com> 于2024年8月29日周四 10:46写道:

> On Wed, Aug 28, 2024 at 9:01 PM Robert Haas <robertmhaas@gmail.com> wrote:
> > On Tue, Aug 27, 2024 at 11:57 PM Tender Wang <tndrwang@gmail.com> wrote:
> > > I haven't look all of them. I just pick few simple plan test(e.g.
> 19.sql, 45.sql).
> > > For example, 19.sql, eager agg pushdown doesn't get large gain, but a
> little
> > > performance regress.
> >
> > Yeah, this is one of the things I was worried about in my previous
> > reply to Richard. It would be worth Richard, or someone, probing into
> > exactly why that's happening. My fear is that we just don't have good
> > enough estimates to make good decisions, but there might well be
> > another explanation.
>
> It's great that we have a query to probe into.  Your guess is likely
> correct: it may be caused by poor estimates.
>
> Tender, would you please help provide the outputs of
>
> EXPLAIN (COSTS ON, ANALYZE)
>
> on 19.sql with and without eager aggregation?
>
> I upload EXPLAIN(COSTS ON, ANALYZE) test to [1].
I ran the same query three times, and I chose the third time result.
You can check 19_off_explain.out and 19_on_explain.out.


[1] https://github.com/tenderwg/eager_agg


-- 
Tender Wang

Commits

  1. Fix eager aggregation for semi/antijoin inner rels

  2. Cover additional errors and corner conditions in repack.c

  3. Fix volatile function evaluation in eager aggregation

  4. Fix collation handling for grouping keys in eager aggregation

  5. Rename apply_at to apply_agg_at for clarity

  6. Fix comment in eager_aggregate.sql

  7. Remove unnecessary include of "utils/fmgroids.h"

  8. Implement Eager Aggregation

  9. Allow negative aggtransspace to indicate unbounded state size

  10. Add macros for looping through a List without a ListCell.

  11. Account for the effect of lossy pages when costing bitmap scans.

  12. Fix a thinko in join_is_legal: when we decide we can implement a semijoin