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: why the index is not used ?

Re: why the index is not used ?

From: <shawc_at_willis.com>
Date: Thu, 27 Apr 2000 11:59:32 +0100
Message-Id: <10480.104272@fatcity.com>


Kevin:

Because you haven't specified any restricting criteria (e.g. col1 = 'value1') in the predicate, the CBO has correctly decided that a sort/merge and full scan of both tables will be less costly than using the indices to access all of the rows in both tables. If you want to verify this, you could try using a hint for one or both indices and see what the estimated cost is from the new explain plan. And bear in mind that any optimizer can only *estimate* costs. Just like the estimate from your local mechanic - the final cost may be very different. But at least with Oracle you can influence the cost. That probably won't work with your mechanic.

Colin.

Please respond to ORACLE-L_at_fatcity.com

To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc:
bcc:

Subject: why the index is not used ?

Hi listers:

I've a simple parent-child relationship query:

SELECT T.BUSINESS_UNIT_ID, T.TRANSFER_ID, T.TRANSFER_OCCURENCE_TYPE, T.TRANSFER_TYPE, T.FROM_SITE_ID, T.TO_SITE_ID, TD.TRANSFER_DETAIL_ID, TD.LINE_NO, TD.ITEM_QTY
FROM TRANSFERS T, TRANSFER_DETAILS TD

WHERE T.BUSINESS_UNIT_ID=TD.BUSINESS_UNIT_ID
AND   T.TRANSFER_ID=TD.TRANSFER_ID
AND   T.TRANSFER_OCCURENCE_TYPE=TD.TRANSFER_OCCURENCE_TYPE;

Table TRANSFERS has PRIMARY KEY ( BUSINESS_UNIT_ID, TRANSFER_ID, TRANSFER_OCCURENCE_TYPE )
Table TRANSFER_DETAILS has PRIMARY KEY ( BUSINESS_UNIT_ID, TRANSFER_ID, TRANSFER_OCCURENCE_TYPE, TRANSFER_DETAIL_ID ) & referential constraint on TRANSFERS and the explain plans are:



SELECT STATEMENT Optimizer=CHOOSE (Cost=13605 Card=923364 Bytes=129270960)

    MERGE JOIN (Cost=13605 Card=923364 Bytes=129270960)     SORT (JOIN)
        TABLE ACCESS (FULL) OF TRANSFERS (Cost=274 Card=126961 Bytes=9268153)     SORT (JOIN)
        TABLE ACCESS (FULL) OF TRANSFER_DETAILS (Cost=1524 Card=923363 Bytes=61865321)


My question is why the primary key index is not used ?

ORACLE: 7.3.4.3 HP-UX
Both tables have been analyzed (compute)?

Any insights ?

TIA Kevin Tsay

--
Author: Kevin Tsay
  INET: Kevin_Tsay_at_liz.com


______________________________________________________________________

The information in this email and in any attachments is confidential and may be
      privileged.  If you are not the intended recipient, please destroy this
      message, delete any copies held on your systems and notify the sender
      immediately.  You should not retain, copy or use this email for any
      purpose, nor disclose all or any part of its content to any other person.
Received on Thu Apr 27 2000 - 05:59:32 CDT

Original text of this message

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