I have to make a choice:
- choice 1: using IN subselect
- choice 2: using INNER JOIN
See the examples:
SELECT contractServiceCode FROM contractServices WHERE contractID IN ( SELECT contractID FROM contracts WHERE companyID IN ( SELECT companyID FROM tblcompanies WHERE informationProvider = 1000000 ) )
SELECT cs.contractServiceCode FROM contractServices as cs INNER JOIN contracts c ON (c.contractID = cs.contractID) INNER JOIN tblcompanies tc ON (tc.companyID = c.companyID) WHERE tc.informationProvider = 1000000
In terms of readability I would say that the INNER JOIN is more readable. But I'm not worried about readablity. In my case performance / CPU / memory usage are import.
So the question is:
Which choice is better in terms of performance?