Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Optimizing Query
On 24 Oct 2001 01:59:49 -0700, Colin
<colinwinning_at_yahoo.com> a écrit:
>The SQL (not PLSQL) being run is
>
>select /*+FIRST_ROWS*/ *
>from clients c, orders o
>where c.id = o.client_id
>and c.processed = 0 --one of about 60 different values, 0 unprocessed
>and o.ordertype = 1 --either 1, 2, or null
>and rownum <= 1000
>
>and it is being run from a separate program. The update is also run from this
>program. The update is being done on the clients table - update processed flag
>when record has been processed.
when indexing orders.ordertype, did you do an "histogram" index ? (this is quite usefull when the values are unbalanced ... I presume the '0' value is much less common than the others)
That way, the optimizer may use the index for '0' and not for 1 or 2 or null (null is not indexed, whatever)
-- DamienReceived on Wed Oct 24 2001 - 11:45:23 CDT