环境的建立:
ORACLE 9208
REM T1: Set up test case
var x number;
var y number;
create table bigtab as select * from all_objects;
create index bt_ix on bigtab (object_id);
execute dbms_stats.gather_table_stats (ownname=>'KONG', -
tabname=>'BIGTAB', CASCADE => TRUE, -
method_opt => 'FOR ALL COLUMNS SIZE 1');
[B]测试第一步:[/B]
在SESSION A中执行:
SQL> SELECT COUNT(*) FROM BIGTAB WHERE OBJECT_ID BETWEEN :x and :y;
COUNT(*)
----------
1
在SESSION B会话查看执行计划:
SQL> select sql_id, sql_text from v$sql
2 where sql_text like 'SELECT COUNT(*) FROM BIGTAB%';
SQL_ID
-------------
SQL_TEXT
--------------------------------------------------------------------------------
ddqk0yd1