Order By will first use your memory which is defined in sort_area_size , if the sort_area_size is not able to allocate the enough memory , Oracle will allocate disk space in temporary tablespace to perform sort , which is considered to be very slow.SO what to do is enlarge the sort area size , so all the sorting is performed in memory only . 

解决方案 »

  1.   

    Only retrieved 108 rows, sort_area_size is large enough to hold the dataset, can you tell me more
      

  2.   

    我是菜鸟 : 但是order by一般跟集函数一起连用的啊,前面的 select 是不要排序的,而用了order by 就要排序。假设memory 足够,最快的排序算法与扫描一遍的时间比 是 x=k*n(lgn)/n (k>1) ;估计n=108 时,x>lg108 差不多 就可能是 3吧。大于 2 应该 是 肯定的!
      

  3.   

    order by 一般在最外层使用, 呵呵 , 从这里就可以看出来!
      

  4.   

    order by 字段本来就是主键, temp space is large enough.
      

  5.   

    在 coid 字段加索引速度快了,ORACLE 是先取结果集再排序还是同步执行 ?
    如是前者就有问题了, 在非 ORDER BY 字段建索引会提高性能?
      

  6.   

    ALTER SESSION SET SORT_AREA_SIZE=50M;
      

  7.   

    实在不行的话,指定检索的hint试试看吧。select /*+ INDEX(customer CUSTID_???_IDX) */ * from customer where coid='29001' order by custid;
      

  8.   

    order by子句中列的次序与索引的次序不一样
      

  9.   

    执行了 ALTER SESSION SET SORT_AREA_SIZE=16777216;
    问题依然!
    我现在关心的是: 在非 ORDER BY 字段建索引会提高性能?