why using different executed plan ?

  • 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

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply