Re: Removing unneeded self joins
Robert Haas <robertmhaas@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
On Fri, May 3, 2024 at 4:57 AM Alexander Korotkov <aekorotkov@gmail.com> wrote: > I agree to revert it for v17, but I'm not exactly sure the issue is > design (nevertheless design review is very welcome as any other type > of review). The experience of the bugs arising with the SJE doesn't > show me a particular weak spot in the feature. It looks more like > this patch has to revise awfully a lot planner data structures to > replace one relid with another. And I don't see the design, which > could avoid that. Somewhere in the thread I have proposed a concept > of "alias relids". However, I suspect that could leave us with more > lurking bugs instead of the bug-free code. I agree that reverting it for v17 makes sense. In terms of moving forward, whether a design review is exactly the right idea or not, I'm not sure. However, I think that the need to replace relids in a lot of places is something that a design review might potentially flag as a problem. Maybe there is some other approach that can avoid the need for this. On the other hand, maybe there's not. But in that case, the question becomes how the patch author(s), and committer, are going to make sure that most of the issues get flushed out before the initial commit. What we can't do is say - we know that we need to replace relids in a bunch of places, so we'll change the ones we know about, and then rely on testing to find any that we missed. There has to be some kind of systematic plan that everyone can agree should find all of the affected places, and then if a few slip through, that's fine, that's how life goes. I haven't followed the self-join elimination work very closely, and I do quite like the idea of the feature. However, looking over all the follow-up commits, it's pretty hard to escape the conclusion that there were a lot of cases that weren't adequately considered in the initial work (lateral, result relations, PHVs, etc.). And that is a big problem -- it really creates a lot of issues for the project when a major feature commit misses whole areas that it needs to have considered, as plenty of previous history will show. When anybody starts to realize that they've not just had a few goofs but have missed some whole affected area entirely, it's time to start thinking about a revert. One of my most embarrassing gaffes in this area personally was a448e49bcbe40fb72e1ed85af910dd216d45bad8. I don't know how I managed to commit the original patch without realizing it was going to cause an increase in the WAL size, but I can tell you that when I realized it, my heart sank through the floor. I'd love to return to that work if we can all ever agree on a way of addressing that problem, but in the meantime, that patch is very dead. And ... if somebody had taken the time to give me a really good design review of that patch, they might well have noticed, and saved me the embarrassment of committing something that had no shot of remaining in the tree. Unfortunately, one of the downsides of being a committer is that you tend to get less of that sort of review, because people assume you know what you're doing. Which is fabulous, when you actually do know what you're doing, and really sucks, when you don't. One of the things I'd like to see discussed at 2024.pgconf.dev is how we can improve this aspect of how we work together. -- Robert Haas EDB: http://www.enterprisedb.com