• purushottam2 (3/7/2013)


    Which one is more performance oriented query?

    1. SELECT 1 FROM table1 WHERE Id IN (SELECT Id FROM table2)

    2. SELECT 1 FROM table1 t1 INNER JOIN table2 t2 ON t1.Id = t2.Id

    It depends on

    1 - If the table2 is small, you can use 1 or 2

    2 - If both are big, you should use second solution and index the columns on ON clause