The first node is an InitPlan, due to the ANY(ARRAY()) - that gets executed and finds 0 matching rows
The second node is the outer node in the Merge Join and that is the expensive node in our query plan
The third node is the inner node in the Merge Join and that node references the SubPlan generated by the first node. The IndexCond has "id = ANY($2) AND ..." and the comparison with the result of the SubPlan does not find a match, so that's where the short-circuiting happens.
Here are the relevant lines from the node (12) accessing the result of the SubPlan:
Le 20/12/2023 à 15:40, Jerry Brenner a écrit : > Whichever side gets executed first, is the execution of the side that > would be second get short circuited if 0 rows are returned by the first > side?
Indeed, if 0 rows are returned from the outer relation, the scan of the inner relation is never executed.