Home Forums SQL Server 2005 T-SQL (SS2K5) EXISTS Subqueries: SELECT 1 vs. SELECT * (Database Weekly 11.02.2008) RE: EXISTS Subqueries: SELECT 1 vs. SELECT * (Database Weekly 11.02.2008)

  • Hi,

    either you can use columns or * or 1 with EXISTS clause.

    The EXISTS clause is based on TRUE or FALSE. it doesn't depend on columns. If you use column names or * then server has to identify what are all the columns that you want to retriev and where they are comming from and whther you have prvileges on those columns are not. so obviously it creates some bit of performance issues.

    so go with 1 where ever you have EXISTS clause.

    Thanks -- Vj

    http://dotnetvj.blogspot.com