Neil Conway <[EMAIL PROTECTED]> writes: > I think this tweak would be universally better than the existing code.
Yes, but you miss the point: there's a case where the existing code isn't good and you aren't improving it. Specifically, where the inner query has high startup cost and the outer query is empty. If you'd pulled from the outer query first then you could avoid the inner startup cost. >> This could all get pretty hairy when you consider that it has to still >> work for left joins too ... > Right; I was planning to bail and only do this for inner joins. Well, for outer joins the optimal strategy is simple: pull from the outer query first. If it's empty then you needn't touch the inner query at all. Otherwise you have to build the hash table. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match