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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: HELP! Index Debate!

RE: HELP! Index Debate!

From: Ron Rogers <RROGERS_at_galottery.org>
Date: Thu, 31 Jul 2003 12:54:24 -0800
Message-ID: <F001.005C808D.20030731125424@fatcity.com>


Ron,
 It has been my understanding that in order for the conpound index to be used the query had to match the order the index was created. Multiple indexes would not do a whole lot of good for you just make the optmizer work harder to figure things out. It would add a confusion factor other wise how would there be a relationship between each column in the index.  An Index on column col1 and a second index on col2 would have a different tree that an index on col1,col2.  With the additional index (compound or not) on the PROD_ID the execution time will decrease as it will use the index scan for the join condition in the where clause T6."PROD_ID"=T4."PROD_ID"(+) . Before there was no index and the full table scan resulted.  Looking at the where clause and in this case the developer might be correct as the where clause referres to the T6 table = to multiple other tables different columns.
Ron

>>> rlsmith_at_kmg.com 07/31/03 04:34PM >>>

Please help resolve this dispute.
We have a query that runs over 5 hours. Sections of the query are listed below.

The table QOH_DAY_FACT table had only on index and that was on the TIME_ID column. I propose adding an index with PROD_ID, WHS_ID, LOT_ID,
WHS_LOC, TIME_ID and QUALITY_ID. My test shows the runtime was reduced
to about 1.5 hours.

The developer said all the columns in the index except PROD_ID were being ignored. He says there should be six separate indexes, one for each column before Oracle will use them.

Also, does the order of the columns in the index have to match the order
of the columns in the WHERE CLAUS or is it more important to match the WHERE CLAUS to the data content (least number of rows first)?

I will be running more tests, but I would like some input on this if anyone has an opinion.

Thanks!
Ron

select T1."COUNTRY_NAME" "c1"
, T2."PRODTN_PROC_NAME" "c2"
, T2."PLANT_NAME" "c3"
, T1."WHS_NAME" "c4"
, T1."WHS_CMPLX_NAME" "c5"
, T3."WHS_LOC_NAME" "c6"
, T4."GRADE_DESC" "c7"
, T4."PACK_DESC" "c8"
, T5."FULL_DT" "c9"
, T6."QOH_MT" "c10".......

....from "DWMART"."DISTRIB_FCLTY_DIM" T1
, "DWMART"."MFG_FCLTY_DIM" T2
, "DWMART"."DISTRIB_LOC_DIM" T3
, "DWMART"."TIME_DIM" T5
, "DWMART"."QUALITY_DIM" T7
, "DWMART"."QOH_DAY_FACT" T6
, "DWMART"."PROD_DIM" T4

where T6."PROD_ID"=T4."PROD_ID"(+)
   and T6."WHS_ID"=T1."WHS_ID"
   and T6."LOT_ID"=T2."LOT_ID"
   and T6."WHS_LOC_ID"=T3."WHS_LOC_ID"

   and T6."TIME_ID"=T5."TIME_ID"
   and T6."QUALITY_ID"=T7."QUALITY_ID"
order by "c9" asc
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net 
-- 
Author: Smith, Ron L.
  INET: rlsmith_at_kmg.com 

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com 
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Ron Rogers
  INET: RROGERS_at_galottery.org

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Jul 31 2003 - 15:54:24 CDT

Original text of this message

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