Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Creating several indexes on same tables - with one FTS only ?

Re: Creating several indexes on same tables - with one FTS only ?

From: MBPP <mpacheco_at_directnet.com.br>
Date: 30 Mar 2005 04:07:39 -0800
Message-ID: <1112184459.564148.44400@z14g2000cwz.googlegroups.com>


What I know is that if you create an index, and the column(s) being indexed already exist(s) in another index, then Oracle uses this index to scan the values instead of doing a full table scan. So if you have many indexes, try to create them in an order which meets this rule if possible. Maybe you can create a "dummy" index first with all indexed columns and then create the others but I don't know if this will save you time. I did a simple test with a table of 100K rows and it was faster but of course this can vary a lot depending on table size, column size, I/O, cache, etc. Take a look at the sample below, it was more than 2x faster.

SQL> describe temp

Name Type

---------------- -------------
COMP_ID          VARCHAR2(10)
ITEM             VARCHAR2(50)

GLOBAL_CUST_NAME VARCHAR2(100)

SQL> create index index_1 on temp (comp_id);

Elapsed: 00:00:01.00

SQL> create index index_2 on temp (item);

Elapsed: 00:00:01.02

SQL> create index index_3 on temp (global_cust_name);

Elapsed: 00:00:01.02

SQL> create index index_0 on temp (comp_id,item,global_cust_name);

Elapsed: 00:00:01.08

SQL> create index index_1 on temp (comp_id);

Elapsed: 00:00:00.07

SQL> create index index_2 on temp (item);

Elapsed: 00:00:00.09

SQL> create index index_3 on temp (global_cust_name);

Elapsed: 00:00:00.08

SQL> drop index index_0;

Elapsed: 00:00:00.00

Received on Wed Mar 30 2005 - 06:07:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US