function base index

create table t1(id number, idd varchar2(10));
insert into t1 values( 1, '11');
insert into t1 values(2, '22');


commit;




SQL> create index idx_idd_t1 on t1(to_number(idd));


Index created.


SQL> select * from t1 where idd='11';


     ID IDD
---------- ----------
      1 11




Execution Plan
----------------------------------------------------------
Plan hash value: 3617692013


--------------------------------------------------------------------------
| Id  | Operation       | Name | Rows  | Bytes | Cost (%CPU)| Time      |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 |    20 |     2   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| T1      |     1 |    20 |     2   (0)| 00:00:01 |
--------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   1 - filter("IDD"='11')


Note
-----
   - dynamic sampling used for this statement (level=2)


SQL>  select * from t1 where to_number(idd)=11;


     ID IDD
---------- ----------
      1 11




Execution Plan
----------------------------------------------------------
Plan hash value: 1463967975


------------------------------------------------------------------------------------------
| Id  | Operation              | Name      | Rows  | Bytes | Cost (%CPU)| Time      |
------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT         |           |     1 |    33 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1      |     1 |    33 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN         | IDX_IDD_T1 |     1 |      |     1   (0)| 00:00:01 |
------------------------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   2 - access(TO_NUMBER("IDD")=11)


Note
-----
   - dynamic sampling used for this statement (level=2)






SQL> select * from  t1 where to_number(idd)=to_number('11');


     ID IDD
---------- ----------
      1 11




Execution Plan
----------------------------------------------------------
Plan hash value: 1463967975


------------------------------------------------------------------------------------------
| Id  | Operation              | Name      | Rows  | Bytes | Cost (%CPU)| Time      |
------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT         |           |     1 |    33 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1      |     1 |    33 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN         | IDX_IDD_T1 |     1 |      |     1   (0)| 00:00:01 |
------------------------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   2 - access(TO_NUMBER("IDD")=11)


Note
-----
   - dynamic sampling used for this statement (level=2)






SQL> select * from  t1 where to_number(idd)=to_number('11');


     ID IDD
---------- ----------
      1 11




Execution Plan
----------------------------------------------------------
Plan hash value: 1463967975


------------------------------------------------------------------------------------------
| Id  | Operation              | Name      | Rows  | Bytes | Cost (%CPU)| Time      |
------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT         |           |     1 |    33 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| T1      |     1 |    33 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN         | IDX_IDD_T1 |     1 |      |     1   (0)| 00:00:01 |
------------------------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------


   2 - access(TO_NUMBER("IDD")=11)


Note
-----
   - dynamic sampling used for this statement (level=2)

發佈了73 篇原創文章 · 獲贊 20 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章