April 10, 2009 at 3:35 am
In the personnel table , there is EmpCode, DeptCode and others fields, I created a clustered index on EmpCode,a non-clustered index on DeptCode, and some other indexs on other fields. I run below tow queries,but they use different Executed plan,the first query is used Table Scan ,the second query is used index seek,Could you please tell reason?
select * from Personnel where DeptCode='SE665' ---Table Scan
select * from Personnel where DeptCode='Dp028' ---index seek
Thanks
April 10, 2009 at 3:43 am
Selectivity and the number of rows that the optimiser thinks will be returned.
http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/
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
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy