Hi all, Function check_outerjoin_delay() is used to detect whether a qual referencing the given relids must be delayed in application due to the presence of a lower outer join.
If the given relids are empty, we should be able to return from this function via the same fast path as for the case that there is no special joins, without going through all the remaining processing. Empty relids can be very common in check_outerjoin_delay(). Think about the query below: select * from a left join (b left join c on true) on coalesce(b.i,1) = 1; The qual 'coalesce(b.i,1) = 1' is detected as maybe_equivalence by distribute_qual_to_rels(), because it doesn't reference any nonnullable rels at the upper left join node (so it is is_pushed_down) and it doesn't reference any nullable rels at the lower left join node as well (so it is not-outerjoin_delayed). Before we treat it as an equivalence clause, we will check that each side of the qual satisfies the not-outerjoin_delayed condition on its own. For the right side, we will check with empty relids in check_outerjoin_delay(). This small revise is not expected to bring performance improvements, but can improve the readability of the code that for empty relids, the qual is always considered as being not-outerjoin_delayed. Is this code change worthwhile? Any thoughts? Thanks -Richard
Fast-path-for-empty-relids-in-check_outerjoin_delay-v1.patch
Description: Binary data