Hello Dilip, Query: select count(*) from t1,t2 where t1.b<t2.b and t1.b > 12000; > > Test Result: > Nest Loop Join with Index Scan : 1653.506 ms > Sort Merge Join for (seq scan) : 610.257ms > > This looks like a great improvement. Repeating Nicolas's question, do you have a real-world example of such joins?
In my experience, I see more queries like "self-join table A and table B where A.time BETWEEN B.time - '1 week' and B.time", similar to what Nicolas and Tom mentioned. As an example, "count users who placed an order in the week following their registration". Can you send a patch so we can also try it? Thanks, -- Hadi