Advertisement

04.17.2008 at 06:47AM PDT, ID: 23330804
[x]
Attachment Details

How to force Oracle to use a specified index?

Asked by DrJekyll in Oracle 8.x

Is there a way to force Oracle to always use a specified index.  The hint does not guarantee this.
Is there another method?  Below is an example where I want to use the specified index.  However
Oracle uses 2 other indices.  The ones chosen by Oracle and the query never completes.  If I delete
those 2 indices Oracle has no choice but to use the ones specified and query runs fine.  The tables/indices are analyzed.  The hints are syntactically correct.
Any ideas?

SELECT /*+  INDEX (mbr3 mrts_batches_received_idx_02) */ mbr.date_of_service,
      mbr.batch_received_date, mbr.billing_area_id,
       mbr.charts_total, mbr.check_in_out, mbr.record_type, mbr.dept_id
    FROM mrts.mrts_batches_received mbr, mrts.mrts_rpt_billing_areas rba3
    WHERE rba3.billing_area_id = mbr.billing_area_id
      AND (mbr.record_type, mbr.billing_area_id, mbr.date_of_service) IN (
          SELECT /*+  INDEX (mbr3 mrts_batches_received_idx_01) */
                 mbr3.record_type, mbr3.billing_area_id, mbr3.date_of_service
               FROM mrts.mrts_batches_received mbr3
               WHERE mbr3.batch_received_date BETWEEN '01-oct-2007' AND  '01-nov-2007'
                 AND mbr3.dept_id = 'C'
                 AND mbr3.check_in_out = 'IN')
      AND (mbr.record_type = 'R'
      OR  mbr.record_type = 'M')
      AND mbr.date_of_service IS NOT NULL
    ORDER BY mbr.billing_area_id, date_of_service, record_type DESC;Start Free Trial
 
Loading Advertisement...
 
[+][-]04.17.2008 at 06:57AM PDT, ID: 21377069

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 07:01AM PDT, ID: 21377128

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 07:07AM PDT, ID: 21377186

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle 8.x
Sign Up Now!
Solution Provided By: Milleniumaire
Participating Experts: 4
Solution Grade: B
 
 
[+][-]04.17.2008 at 07:10AM PDT, ID: 21377225

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.17.2008 at 02:01PM PDT, ID: 21381323

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 04:40AM PDT, ID: 21384884

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 05:46AM PDT, ID: 21401020

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 06:07AM PDT, ID: 21401235

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 10:53AM PDT, ID: 21404305

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628