From: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
---|---|
To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Richard Guo <guofenglinux(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>, Michał Kłeczek <michal(at)kleczek(dot)org>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Subject: | Re: Removing unneeded self joins |
Date: | 2025-01-31 04:57:46 |
Message-ID: | ac34e44e-f8e1-4601-8bb8-fa5e65578832@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 1/10/25 10:13, Alexander Korotkov wrote:
> I've got an off-list report from Alexander Lakhin. The failing query
> is added to the regression tests in the revised patch. The query was
> failing with an error "negative bitmapset member not allowed" issued
> in adjust_relid_set(). In order to fix that I've to teach
> adjust_relid_set() about negative newrelid, it became even more
> similar to replace_relid(). Notable this error happens in
> remove_leftjoinrel_from_query(). This seems to be consequence that we
> made self-join removal and left-joins removal use common
> infrastructure.
I have analysed your change. It pertains to the situation where PHV
references both the outer join and its inner join in phrels but actually
utilises only the outer side of the join.
I agree with your proposed fix and have just rewritten the query to make
it simpler and more consistent with the regression tests (see new
version of the patch in attachment).
Additionally, I noticed that the remove_useless_joins code uses the term
"join removal" in the join.sql tests. I wonder if it might be more
appropriate to revert the name from "Self Join Elimination" back to
"Self Join Removal."
--
regards, Andrei Lepikhov
Attachment | Content-Type | Size |
---|---|---|
v10-0001-Remove-useless-self-joins.patch | text/x-patch | 129.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Sergey Tatarintsev | 2025-01-31 05:08:09 | Re: Restrict publishing of partitioned table with a foreign table as partition |
Previous Message | Sami Imseih | 2025-01-31 04:48:18 | Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch) |