1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
SQL> create table t as select rownum n1, lpad(rownum,10,'0') small_vc
2 from dual
3 connect by level < 10000;
Table created.
SQL> create index ind1_t on t(n1);
Index created.
SQL> exec dbms_stats.gather_table_stats(user, 't', cascade => true);
PL/SQL procedure successfully completed.
SQL> select *
2 from t
3 where n1= 42;
N1 SMALL_VC
---------- ----------
42 0000000042
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------
SQL_ID dtsgjx12bahch, child number 0
-------------------------------------
select * from t where n1= 42
Plan hash value: 3890747269
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 1 | 14 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IND1_T | 1 | | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("N1"=42)
19 rows selected. |
Partager