Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Query faster with multiple WHERE clauses??
The answer is likely no. I'll assume that there is an index on EMP_ID. I'll
also
assume that EMP_ID is unique. Given those assumptions, the index on deptartment
and division would not be used in your query. Further, the query should be VERY
fast.
Of course, if you ran
select * from emp where DEPTARMENT = 20;
That would (likely) run faster.
John Doe wrote:
> 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:16:50 CST
![]() |
![]() |