How to select the main table when joining multiple tables using an internal join?
A) Should I choose the main table depending on its number of columns / rows (for example, a large primary as the main table or to store a larger table as the join table)?
B) If I select a table containing a column that I use as a condition as the main table, will there be any performance?
For example, let's say that there are 2 tables. Table 1 and Table 2. Will there be a difference in performance between the two solutions below
Solution 1:
select t1.empid , t1.name , t1.dept , t2.add , t2.city , t2.country
from Table1 t1
inner join Table2 t2 on t2.empid = t1.empid
where t1.year = 2010
Solution 2:
select t1.empid , t1.name , t1.dept , t2.add , t2.city , t2.country
from Table2 t2
inner join Table1 t1 on t1.empid = t2.empid
where t1.year = 2010
source
share