Index Skip Scan nada mais é que o "split" logico de um indice composto, ou seja, se sua clausula WHERE não tiver todos os campos do indice composto, ele é dividido em menores sub-indices
Exemplo:
--------
SQL> create table teste(a number,b number);
Table created.
SQL> begin
2 for i in 1..1000
3 loop
4 insert into teste values(i, 56);
5 end loop;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> create index idx_teste on teste(a,b);
Index created.
SQL> analyze table teste compute statistics;
Table analyzed.
SQL> explain plan for select /*+ index_ss(teste idx_teste) */ * from teste where b=56;
Explained.
SQL> start ?\rdbms\admin\utlxpls.sql
--------------------------------------------------------------------------------
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
--------------------------------------------------------------------------------
| SELECT STATEMENT | | 1K | 4K| 1001 | | |
| INDEX SKIP SCAN |teste_idx | 1K | 4K| 1001 | | |
--------------------------------------------------------------------------------
Exemplo:
--------
SQL> create table teste(a number,b number);
Table created.
SQL> begin
2 for i in 1..1000
3 loop
4 insert into teste values(i, 56);
5 end loop;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> create index idx_teste on teste(a,b);
Index created.
SQL> analyze table teste compute statistics;
Table analyzed.
SQL> explain plan for select /*+ index_ss(teste idx_teste) */ * from teste where b=56;
Explained.
SQL> start ?\rdbms\admin\utlxpls.sql
--------------------------------------------------------------------------------
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
--------------------------------------------------------------------------------
| SELECT STATEMENT | | 1K | 4K| 1001 | | |
| INDEX SKIP SCAN |teste_idx | 1K | 4K| 1001 | | |
--------------------------------------------------------------------------------
Comentários
Postar um comentário