现在有一张通过year来分区的表
sql 语句使用order by 后效率很慢select top 20 * from table
select top 20 * from table order by year desc,id效率差异很大id 是聚集索引

解决方案 »

  1.   

    union exists   临时表  都试过了 求解
      

  2.   

    select top 20 * from table order by id asc,year desc
    这样可能会好点。 year上面没有索引。不是分区表也有差别。
      

  3.   


    year 是分区索引  即使 就 order by id  效率也 奇慢
      

  4.   

    顶 难道 要用 not in()   ???
      

  5.   

    我这的分页存储过程  用id排序的 top 20 ....where id>..... 效果奇慢 你有什么好的分页存储过程?
      

  6.   

    用 ROW_NUMBER 分页 ?