I have 3 tables, Table1 (with 1020690 records), Table2 (with 289425 records), Table 3 (with 83692 records). I have something like this
SELECT * FROM Table1 T1
LEFT JOIN Table2 T2 ON T1.id=T2.id
LEFT JOIN Table3 T3 ON T1.id=T3.id
and a query like this
SELECT * FROM Table1 T1
LEFT JOIN Table3 T3 ON T1.id=T3.id
LEFT JOIN Table2 T2 ON T1.id=T2.id
The query plan shows that it uses 2 Merge Join for both connections. For the first query, the first merge occurs with T1 and T2, and then with T3. For the second query, the first merge occurs with T1 and T3, and then with T2.
Both of these queries take about the same time (40 seconds), or sometimes Query1 takes a couple of seconds longer.
So my question is: does it have a join order?
source
share