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: Where question

Re: Where question

From: <michael_bialik_at_my-deja.com>
Date: Wed, 13 Oct 1999 20:59:16 GMT
Message-ID: <7u2rqs$asp$1@nnrp1.deja.com>


Hi.

 If you are using RBO then it will use index.  For CBO it will use the index as well assuming you have  a non-trivial amount of data.
 Use EXPLAIN to verify the index usage.  You may use hints to "push" optimizer to use index :  SELECT /*+ FIRST_ROWS */ *
  FROM emp
  WHERE emp_id = 'XXX' AND salary > 10000

 SELECT /*+ index(emp) */ *
  FROM emp
  WHERE emp_id = 'XXX' AND salary > 10000

 The order of fields does not matter.

 HTH. Michael.

In article <3804A345.89870870_at_hotmail.com>,   Mario Yepes <pafu_at_hotmail.com> wrote:
>
> --------------007269B43262A618446BA508
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Hi !!
>
> I have an idiot question, suppose that I have a table with these
fields:
>
> empl_id, name, address, zipcode, salary
>
> And an index by empl_id, salary
>
> How I should use the where clause to "take or use" that index
>
> where empl_id = 'xxx'
> and salary > 10000;
>
> or
>
> where salary > 10000;
> and empl_id = 'xxx';
>
> Regards,
> Diego
>
> --------------007269B43262A618446BA508
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hi !!
> <p>I have an idiot question, suppose that I have a table with these
fields:
> <br>empl_id, name, address, zipcode, salary
> <p>And an index by empl_id, salary
> <p>How I should use the <b>where</b> clause to "take or use" that
index
> <p>where empl_id = 'xxx'
> <br>&nbsp;&nbsp; and&nbsp; salary > 10000;
> <p><b>or</b>
> <p>where salary > 10000;
> <br>&nbsp;&nbsp; and empl_id = 'xxx';
> <p>Regards,
> <br>Diego</html>
>
> --------------007269B43262A618446BA508--
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Oct 13 1999 - 15:59:16 CDT

Original text of this message

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