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 -> Re: UNUSED INDEX on CHAR fields

Re: UNUSED INDEX on CHAR fields

From: Tapio Luukkanen <tapio.luukkanen_at_vtt.fi>
Date: 2000/07/09
Message-ID: <waem53bjzo.fsf@tiuhti.tte.vtt.fi>#1/1

sklusmann_at_my-deja.com writes:

> ... you may suspect me correctly to be not deeply engaged with SQL, but
> how then can I persuade the ORACLE-Server to do it vice versa, that
> means:
>
> full scanning varlist
> for each row we find
> do an index lookup into v_btypen

An old trick is to concatenate '' (or add 0), to the field which belongs to the table which you want to drive the query with, this will prevent using an index on that field.

       SELECT MAX(a.v_adr + a.v_size * b.pc_size) max_size
       FROM   varlist a, v_btypen b
       WHERE  a.v_typ||'' = b.name;

This is even somewhat portable - I've used it successfully (for numerical fields, like in "A.KEY+0 = B.KEY") in both Oracle and MS SQL*Server, don't know about other systems, though.

-Tapio. Received on Sun Jul 09 2000 - 00:00:00 CDT

Original text of this message

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