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

Home -> Community -> Usenet -> c.d.o.tools -> Query faster with multiple WHERE clauses??

Query faster with multiple WHERE clauses??

From: John Doe <fake_at_address.fake>
Date: Thu, 18 Jan 2001 07:08:19 GMT
Message-ID: <DDw96.1891$7a4.160309@newsread2.prod.itd.earthlink.net>

I think this is probably a pretty basic DB/SQL question, but I could seem to find the answer in any searches.

Let's say for example I have a table of 200,000 employees in table 'emp' and I want to query for employee #867. I could do this:

SELECT * FROM emp WHERE emp_id = 867

..... but, assuming 'division' and 'department' are also indexed, would the following be faster?.....

SELECT * FROM emp WHERE division = 'distribution' AND department = 'delivery' AND emp_id = 867

I'm going under the assumption that since there are their are fewer numbers of departments and fewest number of divisions, if they were indexed columns, that it would help Oracle more quickly 'narrow' down its search. Or maybe I'm just dreaming?

Thanks!!!! Received on Thu Jan 18 2001 - 01:08:19 CST

Original text of this message

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