有关排序的优化器统计信息

时间:2011-05-12 01:19:33

标签: database oracle sorting sql-order-by sql-execution-plan

我是Oracle 11g的新手,我对执行计划有一个问题。我运行了一个查询,即使查询中没有ORDER BY子句,执行计划的统计信息仍然显示内存中有6种排序。有人可以向我解释为什么会这样吗?以下是查询和统计信息:

SQL> SELECT ZIP FROM NOZIPSORT WHERE ZIP BETWEEN '10000' AND '29999' AND rownum < 26;

25 rows selected.

Elapsed: 00:00:00.07

Execution Plan
----------------------------------------------------------
Plan hash value: 4176934817

--------------------------------------------------------------------------------
| Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |           |    25 |   150 |     2   (0)| 00:00:01 |
|*  1 |  COUNT STOPKEY     |           |       |       |            |          |
|*  2 |   TABLE ACCESS FULL| NOZIPSORT |    28 |   168 |     2   (0)| 00:00:01 |
--------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter(ROWNUM<26)
   2 - filter("ZIP"<='29999' AND "ZIP">='10000')


Statistics
----------------------------------------------------------
        311  recursive calls
          0  db block gets
         47  consistent gets
         38  physical reads
        520  redo size
        805  bytes sent via SQL*Net to client
        431  bytes received via SQL*Net from client
          3  SQL*Net roundtrips to/from client
          6  sorts (memory)
          0  sorts (disk)
         25  rows processed

1 个答案:

答案 0 :(得分:3)

我会说这将是正在进行某些排序的递归调用 - 例如解析查询时,需要查询数据字典以检查表和列定义,其中一些查询将涉及DISTINCT或其他需要排序的操作。