Say I have 3 tables, A, B , C of sizes 10, 10^4 and 10^6. What is the most efficient way to join them?
This is my reasoning. Assuming you join over primary key, if you join A with C first, you will do 10^7 operations. Also, you will be left with 10 rows in the end at most since A has 10 rows. If you then join the result with B, you will do 10^ 5 operations. Thus, total is 10^ 7 + 10^ 5 .
You do same number of operations if you join A with B and then the result with C. Does the join order really matter here?
Aucun commentaire:
Enregistrer un commentaire