Re: Removing unneeded self joins
Andrei Lepikhov <a.lepikhov@postgrespro.ru>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove GUC_NOT_IN_SAMPLE from enable_self_join_elimination
- 717d0e8dd945 18.0 landed
-
Put enable_self_join_elimination into postgresql.conf.sample
- c2d329260cd8 18.0 landed
-
Get rid of ojrelid local variable in remove_rel_from_query()
- e167191dc146 18.0 landed
-
Implement Self-Join Elimination
- fc069a3a6319 18.0 cited
-
Revert: Remove useless self-joins
- d1d286d83c0e 17.0 landed
-
Replace lateral references to removed rels in subqueries
- 466979ef031a 17.0 landed
-
Replace relids in lateral subquery parse tree during SJE
- 489072ab7a9e 17.0 landed
-
Forbid SJE with result relation
- 8c441c082797 17.0 landed
-
Fix misuse of RelOptInfo.unique_for_rels cache by SJE
- 30b4955a4668 17.0 landed
-
Replace the relid in some missing fields during SJE
- a7928a57b9f0 17.0 landed
-
Revert 56-bit relfilenode change and follow-up commits.
- a448e49bcbe4 16.0 cited
-
Stabilize timetz test across DST transitions.
- 4a071afbd056 14.0 cited
-
Speed up finding EquivalenceClasses for a given set of rels
- 3373c7155350 13.0 cited
-
Fix mark-and-restore-skipping test case to not be a self-join.
- 24d08f3c0a1f 12.0 landed
Attachments
- v24-0001-Remove-self-joins.patch (text/x-patch)
Thank you for this partial review, I included your changes: On 9/23/20 9:23 AM, David Rowley wrote: > On Fri, 3 Apr 2020 at 17:43, Andrey Lepikhov <a.lepikhov@postgrespro.ru> wrote: > Doing thing the way I describe will allow you to get rid of all the > UniqueRelInfo stuff. Thanks for the review and sorry for the late reply. I fixed small mistakes, mentioned in your letter. Also I rewrote this patch at your suggestion [1]. Because of many changes, this patch can be viewed as a sketch. To change self-join detection algorithm I used your delta patch from [2]. I added in the split_selfjoin_quals routine complex expressions handling for demonstration. But, it is not very useful with current infrastructure, i think. Also I implemented one additional way for self-join detection algorithm: if the join target list isn't contained vars from inner relation, then we can detect self-join with only quals like a1.x=a2.y if check innerrel_is_unique is true. Analysis of the target list is contained in the new routine - tlist_contains_rel_exprs - rewritten version of the build_joinrel_tlist routine. Also changes of the join_is_removable() routine is removed from the patch. I couldn't understand why it is needed here. Note, this patch causes change of one join.sql regression test output. It is not a bug, but maybe fixed. Applied over commit 4a071afbd0. > [1] https://www.postgresql.org/message-id/CAKJS1f8p-KiEujr12k-oa52JNWWaQUjEjNg%2Bo1MGZk4mHBn_Rg%40mail.gmail.com [2] https://www.postgresql.org/message-id/CAKJS1f8cJOCGyoxi7a_LG7eu%2BWKF9%2BHTff3wp1KKS5gcUg2Qfg%40mail.gmail.com -- regards, Andrey Lepikhov Postgres Professional