November 12, 2014 at 7:47 pm
I have a covering index on (City, State).
Is the SQL server engine smart enough to use the covering index on this query:
SELECT * FROM Table
WHERE Z.City = @City
AND Zip = '10016'
AND Z.State = @State
Or does the query need to be written with the parameters in the same order as the covering index to get the best results?
e.g.
SELECT * FROM Table
WHERE Z.City = @City
AND Z.State = @State
AND Zip = '10016'
Thanks... I have queries with lots of params and not sure if order matters for the use of covering index.
November 12, 2014 at 10:42 pm
Order of parameters in a where clause does not matter
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 12, 2014 at 10:45 pm
Thanks a lot!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply