![](https://csdnimg.cn/release/download_crawler_static/88911203/bg4.jpg)
ID COUNT(*)
---------- ----------
1 72710
99 1
//查看表信息,数据分布
SQL> create index t_ind on t(id);
Index created.
//在 ID 列创建 b*tree 索引
效果验证
-------------------------------------RBO------------------------
SQL> set autotrace trace explain
//打开执行计划
SQL> select /*+ rule +*/ * from t where id = 99;
//强制使用规则查询 ID 为 99 的行记录
Execution Plan
----------------------------------------------------------
Plan hash value: 1376202287
---------------------------------------------
| Id | Operation | Name |
---------------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | TABLE ACCESS BY INDEX ROWID| T |
|* 2 | INDEX RANGE SCAN | T_IND |
---------------------------------------------
Predicate Information (identified by operation id):