第二个非聚集索引建的就非常不合理.如果按除了GoType1的别的字段查询的话,就会造成非聚集索引的失效.所以建议对每一个字段单独建立非聚集索引.

解决方案 »

  1.   

    select GoType1,GoType2,BeginsProvince,BeginsCity,EndsProvince,EndsCity,OrPrice,PrPrice from CarS_Source where GoType1='公路运输' and GoType2='短程配送' and BeginsProvince='广东' and BeginsCity='深圳' and EndsProvince='广东' and EndsCity='汕头' and OrPrice < 20 and PrPrice < 30 and  Pubsdate > dateadd(day,-30,getdate())大部分查询语句都是这种形式的,区别基本就是少几个where条件而已,我那样建索引合不合理呢?
    还有我想把Pubsdate字段都建立聚集索引和非聚集索引,这样两种索引都建在这一个字段上的做法会不会提高效率呢?
      

  2.   

    create index province1 on Cargo_Sourc(GoType1)create index province2 on Cargo_Sourc(GoType2)create index province3 on Cargo_Sourc(BeginsProvince)create index province4 on Cargo_Sourc(BeginsCity).....
    mschen(发光的星星)说的是这么做吧?