Subject: Re: Eager aggregation, take 3

From: Richard Guo <[email-masked]>
Date: Tue, 30 Apr 2024 12:06:42 +0800

Here is an update of the patchset with the following changes:

* Fix a 'Aggref found where not expected' error caused by the PVC call
in is_var_in_aggref_only.  This would happen if we have Aggrefs
contained in other expressions.

* Use joinrel's relids rather than the union of the relids of its outer
and inner to search for its grouped rel.  This is more correct as we
need to include OJs into consideration.

* Remove RelAggInfo.agg_exprs as it is not used anymore.

Thanks
Richard

---

From: Richard Guo <[email-masked]>
Date: Mon, 20 May 2024 16:12:49 +0800

Another rebase is needed after d1d286d83c.  Also I realized that the
partially_grouped_rel generated by eager aggregation might be dummy,
such as in query:

select count(t2.c) from t t1 join t t2 on t1.b = t2.b where false group by
t1.a;

If somehow we choose this dummy path with a Finalize Agg Path on top of
it as the final cheapest path (a very rare case), we would encounter the
"Aggref found in non-Agg plan node" error.  The v7 patch fixes this
issue.

Thanks
Richard