SQL Server Performance Forum – Threads Archive
Multiple Tables in Select – From
We’re having a discussion around our IT Dept. And have not come to a concensus. When using the Select… If you do NOT reference a table in the fields area – but DO reference a table with an inner/outer join, do these extra tables that are "joined" but NOT used – are they slowing sql down? Thanks
Depends on what you call "not used" – it’s not only the column list that is relevant … SELECT A.col FROM A LEFT JOIN B ON A.fk = B.rk SELECT A.col FROM A INNER JOIN B ON A.fk = B.rk With the LEFT JOIN, SQL Server will ignore table B completely. You can leave the statement as it is, or clean it up – no big deal either way. With the INNER JOIN, table B (or an appropriate index on B) must be scanned in order to get the correct results.