Joining Tables: Table OrderWhat is the best order?
For each A row do an index
(1,000 for A + 1,000*4 for B)
Index scan of B (3 reads), then the data (10 reads) for a toal of 13
For each B row do an index
Table A - 1,000 rows Table B - 50,000 rows
Select * from A, B
where A.join_col = B.join_col
and B.filter_col = 1
General Rule: The table which returns the fewest rows, either through a filter or the record count, should be first.
Assume 10 rows in B meet this condition