Re: Removing unneeded self joins
jian he <jian.universality@gmail.com>
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
- v3-0002-make-SJE-to-apply-DML-MERGE-UPDATE-INSERT-DELETE.patch (text/x-patch) patch v3-0002
- v3-0003-use-SJE-conditionally-with-delete-update-merge-RE.patch (text/x-patch) patch v3-0003
- v3-0001-Remove-useless-self-joins.patch (text/x-patch) patch v3-0001
On Mon, Jun 17, 2024 at 8:00 AM jian he <jian.universality@gmail.com> wrote: > > > Another thing that made me pretty sad was 8c441c082 (Forbid SJE with > > result relation). While I don't claim that that destroyed the entire > > use case for SJE, it certainly knocked its usefulness down by many > > notches, maybe even to the point where it's not worth putting in the > > effort needed to get it to re-committability. So I think we need to > > look harder at finding a way around that. Is the concern that > > RETURNING should return either old or new values depending on which > > RTE is mentioned? If so, maybe the feature Dean has proposed to > > allow RETURNING to access old values [1] is a prerequisite to moving > > forward. Alternatively, perhaps it'd be good enough to forbid SJE > > only when the non-target relation is actually mentioned in RETURNING. > > > > regards, tom lane > > > > [1] https://www.postgresql.org/message-id/flat/CAEZATCWx0J0-v=Qjc6gXzR=KtsdvAE7Ow=D=mu50AgOe+pvisQ@mail.gmail.com attached patchset: v3-0001-Remove-useless-self-joins.patch v3-0002-make-SJE-to-apply-DML-MERGE-UPDATE-INSERT-DELETE.patch v3-0003-use-SJE-conditionally-with-delete-update-merge-RE.patch v3-0001: based on [1] patch, replace all replace_varno to ChangeVarNodes. v3-0002: make SJE apply to UPDATE/DELETE/MERGE v3-0003: make SJE apply to UPDATE/DELETE/MERGE RETURNING conditionally v3-0001, v3-0002 content, reasoning is the same as the previous thread[2]. v3-0003 is new. to make sure it's correct, I have added a lot of tests, Some of this may be contrived, maybe some of the tests are redundant. [1]: https://postgr.es/m/55f680bc-756d-4dd3-ab27-3c6e663b0e4c%40postgrespro.ru [2]: https://postgr.es/m/CACJufxG3sqJKe1OskHhn7OCdtrEeeRFcD8R4TTQE%2BLGJEQaL9w%40mail.gmail.com