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 49 50 51
| SQL> create table dvp ( a varchar2(10), b number ) ;
Table créée.
SQL>
SQL> declare
2 i number ;
3 begin
4 for i in 0..100000
5 loop
6 insert into dvp values ( 'Oracle', i) ;
7 end loop ;
8 commit ;
9 end ;
10 /
Procédure PL/SQL terminée avec succès.
SQL> create index dvp_ind on dvp ( b) ;
Index créé.
SQL> set autot trace exp
SQL> select * from dvp where b= 2536 ;
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'DVP'
2 1 INDEX (RANGE SCAN) OF 'DVP_IND' (NON-UNIQUE)
SQL> analyze table dvp compute statistics ;
Table analysée.
SQL> analyze index dvp_ind compute statistics ;
Index analysé.
SQL> select * from dvp where b= 2536 ;
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=10)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'DVP' (Cost=2 Card=1 Byte
s=10)
2 1 INDEX (RANGE SCAN) OF 'DVP_IND' (NON-UNIQUE) (Cost=1 Car
d=1) |
Partager