Re: plan shape work - Mailing list pgsql-hackers
From | Robert Haas |
---|---|
Subject | Re: plan shape work |
Date | |
Msg-id | CA+TgmoYzrueUuzCoqTVNTcMh1g3MJ_Y=XEq5kdrUfu8A6FTNQQ@mail.gmail.com Whole thread Raw |
In response to | Re: plan shape work (Tom Lane <tgl@sss.pgh.pa.us>) |
Responses |
Re: plan shape work
Re: plan shape work |
List | pgsql-hackers |
On Fri, Sep 12, 2025 at 12:18 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Not the RelOptInfo, but the Path. I have not looked at details, but > it might be necessary to identify these labels at Path construction > time rather than reconstructing them during createplan.c. I'd rather > not, because bloating Path nodes with hopefully-redundant information > isn't attractive. But if it turns out that createplan.c doesn't have > enough information then we might have to. My intuition (which might be wrong) is that there's enough information available to do it during createplan.c, but I'm not sure that there's enough information available to do it efficiently at that stage. You could grovel through the whole Plan tree and find all of the scan RTIs, and then from there you should be able to work out what joins were commuted, and then from there you should be able to work out which SpecialJoinInfo goes with each Join that appears in the final plan tree. That doesn't sound like a lot of fun, though. On the other hand, I'm not sure doing this at Path creation time is going to be a picnic either. Right now, we're sort of cheating by only caring about what OJs are finished at a certain level: that is consistent across all possible ways of forming a joinrel, but which OJs are started at a certain level is not, and I'm not currently seeing how to fix that without adding cycles. > I'm also thinking that this notion of starting/completing OJs might be > useful in its own right to clarify and even simplify some of the Path > manipulations we do. But that will require reviewing the code. Makes sense. > If what you want to do is only interested in baserel RTIs, then I > think we should leave outer join RTIs out of the discussion for the > present. I was not looking to make you do work you aren't interested > in. I reserve the right to do said work later ... Absolutely. I'm more than happy to have you do that. We sort of got started down this path because, reviewing v4-0003, Richard commented that I might be able to sanity-check something-or-other about RTE_JOIN RTIs instead of just focusing on baserels. From there, this sub-thread has turned into a discussion of exactly what that sanity check should be. v5 exposes the completed-at-this-level OJs in the final plan tree, which is easy to compute and could be useful for somebody's plan introspection, but (1) I don't need it and (2) it just derives them from the joinrel's RTI set rather than in any independent per-path way that might lead to a more meaningful cross-check. Having done the work to create v5-0003, I find myself thinking it feels a little tidier than v4 and am somewhat inclined to prefer it; I think that it's very possible that you or Richard might find it a useful basis for future work to further strengthen the way things work in this area. However, on the other hand, maybe not, and going back to v4-0003 is also completely reasonable. I don't care much one way or the other as long as nobody's too mad when the dust settles. But, I also can't commit either v4-0003 or v5-0003 or any variant thereof until we agree on what to do about 0001, and you're the holdout there. v5-0001 adds a result_type field to the Result node in response to your previous review comments, so knowing whether that looks like what you want or whether you would prefer something else is the blocker for me as of this moment. Thanks, -- Robert Haas EDB: http://www.enterprisedb.com
pgsql-hackers by date: