如果符合条件的数据较少时,乙快,如果符合条件的纪录较多,使用TOP较快。

解决方案 »

  1.   

    去掉Order by 子句试试。
      

  2.   

    Top+order by不会节约检索的时间,只能节约输出的时间。
      

  3.   

    看看执行计划,swordmanli(太白)说的对,如果符合条件的数据较少时,乙快,如果符合条件的纪录较多,使用TOP较快。不过我认为分析一下执行计划就知道那儿用时多.
      

  4.   

    试一下这两个语句:甲:select top 10 b.ResourceID,b.nodeid from  a,c,b ,KeywordView d where a.ResourceID=b.ResourceID and b.NodeID=c.NodeID and a.resourceid=d.resourceid  and (c.NodeID=102 or c.NodePath like '0>1>%') and a.MediumID in(10,1,7,8) and b.DeleteFlag='V' 
    and d.AllKeyword like '%中国%'
    order by a.Title Asc乙:select b.ResourceID,b.nodeid from  a,c,b ,KeywordView d where a.ResourceID=b.ResourceID and b.NodeID=c.NodeID and a.resourceid=d.resourceid  and (c.NodeID=102 or c.NodePath like '0>1>%') and a.MediumID in(10,1,7,8) and b.DeleteFlag='V' 
    and d.AllKeyword like '%中国%'
    order by a.Title Asc
      

  5.   

    like '%中国%' 不能应用索引,而且比较性能较差,条件靠后放