| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
| Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, 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-30 15:30:57 |
| Message-ID: | CA+TgmoZF7eSN=H_p3UKMQL4ruf1Ai0Lh8Bb=fFbkRjH-gGPaVQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 29, 2024 at 3:51 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> > 2. join type is FULL JOIN, (i am not sure about other Semijoins and
> > anti-semijoins types).
>
> The presence of a FULL JOIN does not preclude the use of eager
> aggregation. We still can push a partial aggregation down to a level
> that is above the FULL JOIN.
I think you can also push a partial aggregation step through a FULL
JOIN. Consider this:
SELECT p.name, string_agg(c.name, ', ') FROM parents p FULL JOIN
children c ON p.id = c.parent_id GROUP BY 1;
I don't see why it matters here that this is a FULL JOIN. If it were
an inner join, we'd have one group for every parent that has at least
one child. Since it's a full join, we'll also get one group for every
parent with no children, and also one group for the null parent. But
that should work fine with a partially aggregated c.
--
Robert Haas
EDB: http://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2024-10-30 16:03:57 | Re: Interrupts vs signals |
| Previous Message | Robert Haas | 2024-10-30 15:25:31 | Re: Eager aggregation, take 3 |