Questionnement sur les INDEX
Bonjour,
Je cherche à comprendre pourquoi dans l'exemple qui suit l'index composé et plus rapide que l'index simple.
Je suis sous Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
create table test as(
select level as test_pk,dbms_random.string('L',10) as libelle from dual
connect by level<1e6);
update test set libelle='mwqwbtcajg' where test_pk between 15000 and 15050;
commit;
create index idx_lib_test_pk on test
( libelle,test_pk);
create index idx_lib_pk on test
( libelle);
analyze table test compute statistics; |
Avec
Code:
1 2
| select /*+ INDEX(t IDX_LIB_TEST_PK) */* from test t
where libelle = 'mwqwbtcajg' |
J'obtiens un cout de 3
Avec
Code:
1 2
| select /*+ INDEX(t IDX_LIB_PK) */* from test t
where libelle = 'mwqwbtcajg' |
J'obtiens un cout de 4
Pourquoi cette différence ?