November 9, 2014 at 6:44 pm
To optimize this:
SELECT TOP 1 ZipCode FROM dbo.ZipCodes Z
WHERE Z.City = @City
AND Z.State = @State
Should I create an index on City and an index on State
Or..
Create one covering index (City, State)
Is there a significant difference? Thanks.
November 10, 2014 at 5:29 am
Hi,
A covering index with (City, State) will give better performance. Two separate indexes will not give the same performance.
/Johan Lindh
November 10, 2014 at 9:07 am
http://sqlinthewild.co.za/index.php/2010/09/14/one-wide-index-or-multiple-narrow-indexes/
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 10, 2014 at 9:24 am
Thank you!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply