- 最后登录
- 2018-9-17
- 在线时间
- 27 小时
- 威望
- 104
- 金钱
- 547
- 注册时间
- 2012-2-7
- 阅读权限
- 50
- 帖子
- 54
- 精华
- 0
- 积分
- 104
- UID
- 208
|
12#
发表于 2012-5-9 22:02:39
1* SELECT /*+ INDEX(TEST IDX_OWNER) */ OBJECT_TYPE FROM TEST WHERE OBJECT_TYPE IS NOT NULL
21:03:01 SQL> /
Execution Plan
----------------------------------------------------------
Plan hash value: 3577366606
-----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 202K| 1775K| 5820 (1)| 00:01:10 |
|* 1 | TABLE ACCESS BY INDEX ROWID| TEST | 202K| 1775K| 5820 (1)| 00:01:10 |
| 2 | INDEX FULL SCAN | IDX_OWNER | 202K| | 474 (2)| 00:00:06 |
-----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
1 - filter("OBJECT_TYPE" IS NOT NULL)
well,Y does this hint could generate INDEX FULL SCAN?I just query with a "not null " constraint,So,can i just put it this way that if there's neither "NOT NULL" constriant on that column nor an index on that column,then,the index_ffs will not function. But with the "NOT NULL" constraint and a hint "index",it then will execute as the hint indicates,a index full scan?just as following:
21:59:01 SQL> select /*+ index_ffs(test idx_obj_id) */ object_type from test where object_type is not null;
Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 202K| 1775K| 616 (2)| 00:00:08 |
|* 1 | TABLE ACCESS FULL| TEST | 202K| 1775K| 616 (2)| 00:00:08 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_TYPE" IS NOT NULL)
21:59:12 SQL> select /*+ index(test idx_obj_id) */ object_type from test where object_type is not null;
Execution Plan
----------------------------------------------------------
Plan hash value: 143832116
------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 202K| 1775K| 202K (1)| 00:40:33 |
|* 1 | TABLE ACCESS BY INDEX ROWID| TEST | 202K| 1775K| 202K (1)| 00:40:33 |
| 2 | INDEX FULL SCAN | IDX_OBJ_ID | 202K| | 451 (2)| 00:00:06 |
------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_TYPE" IS NOT NULL)
[ 本帖最后由 orafans 于 2012-5-9 22:03 编辑 ] |
|