我们可以恢复之前的统计信息,生成原本的执行计划

 

SQL> BEGIN

  2  DBMS_STATS.restore_table_stats(ownname => 'DAO',tabname => 'TEST_STATS',as_of_timestamp => '27-JUN-14 05.40.33.314757 PM +08:00');

  3  END ;

  4  /

PL/SQL procedure successfully completed.



SQL> select  count(*) from  test_stats ;

  COUNT(*)

----------

     75675



Execution Plan

----------------------------------------------------------

Plan hash value: 2395052010


------------------------------------------------------------------------------

| Id  | Operation             | Name         | Rows  | Cost (%CPU)| Time     |

------------------------------------------------------------------------------

|   0 | SELECT STATEMENT      |              |     1 |    44   (0)| 00:00:01 |

|   1 |  SORT AGGREGATE       |              |     1 |            |          |

|   2 |   INDEX FAST FULL SCAN| DAO_STATS_PK | 75675 |    44   (0)| 00:00:01 |

------------------------------------------------------------------------------



Statistics

----------------------------------------------------------

          0  recursive calls

          0  db block gets

       1081  consistent gets

          0  physical reads

          0  redo size

        528  bytes sent via SQL*Net to client

        523  bytes received via SQL*Net from client

          2  SQL*Net roundtrips to/from client

          0  sorts (memory)

          0  sorts (disk)

          1  rows processed