I have 3 tables.
table_a 5m records
table_b 20m records
table_c 20m records
I'm performing the query below.
SELECT * FROM table_a a INNER JOIN table_b b ON a.a_id = b.a_id AND b.b_come='100' INNER JOIN table_c c ON b.c_id = c.c_id AND c.c_type IN ('A','B') WHERE date(a.a_dt) = '01/01/2012 00:00:00.000'
The query is quite slow. I think it is because the data in its nature they have
about 1000 records of a.a_id = b.a_id
about 20m*20m records of b.c_id = c.c_id.
I think I should get the result of a.a_id = b.a_id then do the one of b.c_id = c.c_id so that the performance could be a lot better. But it seems INNER JOIN has no concept of order. How should I do this to improve the performance?