Select top 100
 a.ContractSupplier
 from Org a,Employee b,Providers c 
 where a.OrgID = b.OrgID and 
 a.ContractSupplier = c.CName and c.IsUse = '01' and b.EmpID=965623
其中
ORG表ORgID 主键
employee表employeeId主键
Providers 表没有用上主键和索引

解决方案 »

  1.   

    主键默认聚集索引。一个表只能有一个聚集索引,没主见的那个表上在where后的字段家聚集索引
      

  2.   

    Providers 的 (CName,IsUse)增加索引如果IsUse的重复率不高,可以建立(IsUse,CName)索引或者单独(IsUse)索引
      

  3.   


    Select top 100
     a.ContractSupplier
     from Org a,Employee b,Providers c
    inner join Employee b on b.EmpID=965623
               and a.OrgID = b.OrgID
    inner join Providers c on c.IsUse = '01'
               and a.ContractSupplier = c.CName避免生成笛卡尔积,用表关联尽可能在初期就减少选区数据集和
      

  4.   

    ContractSupplier 
    c.CName 
     c.IsUse 
     b.EmpID都可以考虑索引,关键看你表的数据分布情况,重复率很重要还有就是每个表都要有个主键可以提高索引使用率。