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,

    The point about which index is used seems a bit superfluous to me because the remaining part of the select is what makes the server choose the index.

    If I perform: select 1 from table where col1 = value

    and col1 has no index then there is only the benefit of not having to find the columns of "table" by using select 1, right?

    I would only agree with the statement that select 1 would choose the best index, if col1 was in more than one index on table. The server would then look which index is best used for the "where" part of the statement and then use that.

    So the performance winner with select 1 is that the server doesn't take the hit for column checks.

    Am I barking up the wrong tree here or does it sound sane to you guys?

    Thanks

    GermanDBA

    Regards,

    WilliamD