1.查看表分析情况
SQL> select T.LAST_ANALYZED from dba_tables t where owner = 'TEST' and table_name ='WH';
LAST_ANAL
---------
xxx
2.删除表分析信息
exec DBMS_STATS.DELETE_TABLE_STATS('test','wh');
3.执行sql 观察
SQL> select count(*) from test.wh where object_id > 80 and object_id < 30;
Execution Plan
----------------------------------------------------------
Plan hash value: 1304248303
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 0 (0)| |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | FILTER | | | | | |
|* 3 | TABLE ACCESS FULL| WH | 12 | 156 | 297 (1)| 00:00:04 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(NULL IS NOT NULL)
3 - filter("OBJECT_ID">80 AND "OBJECT_ID"<30)
Note
-----
- dynamic sampling used for this statement (level=2)
提示为动态采样
SQL> select T.LAST_ANALYZED from dba_tables t where owner = 'TEST' and table_name ='WH';
LAST_ANAL
---------
xxx
2.删除表分析信息
exec DBMS_STATS.DELETE_TABLE_STATS('test','wh');
3.执行sql 观察
SQL> select count(*) from test.wh where object_id > 80 and object_id < 30;
Execution Plan
----------------------------------------------------------
Plan hash value: 1304248303
----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | 0 (0)| |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | FILTER | | | | | |
|* 3 | TABLE ACCESS FULL| WH | 12 | 156 | 297 (1)| 00:00:04 |
----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(NULL IS NOT NULL)
3 - filter("OBJECT_ID">80 AND "OBJECT_ID"<30)
Note
-----
- dynamic sampling used for this statement (level=2)
提示为动态采样
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7569309/viewspace-2133728/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7569309/viewspace-2133728/