I'm doing some optimizations and I need some technical help regarding optimization.
Consider the following query :
FROM Employees E
JOIN Data D ON E.idDataType = D.idDataType
WHERE E.idDataType = 1
Does it matter (from optimization point of view) if I filter the parent table or the child table? Which one would be faster?
E.idDataType = 1 VS D.idDataType = 1
1 A X 3 xx
2 B T 2 xx
ForeginKey(idDataType) References Data(idDataType);
No, it does not matter, the result will be the same. Even if they would have different execution times, the DataBase would take care of that so it will always be executed in the fastest possible way.
* has probably a greater impact.