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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Forcing use of an index

Re: Forcing use of an index

From: Peter Marksteiner <pm_at_katz.cc.univie.ac.at>
Date: 19 Mar 2005 12:02:38 GMT
Message-ID: <423c14de$0$10836$3b214f66@usenet.univie.ac.at>


Bob P <bob_pombrio_at_yahoo.com> wrote:
: I have a nasty little problem going on here and I'm open to
: suggestions.

: First the set up =

: Table - A
: load_id vchar2(12) not null
: .
: .
: (other columns)

: Index IA1 (not primary key)
: load_id, (other columns)

: Now the query:
: Select (some stuff) From a
: where load_id like '%7339%'
: And other columns = values

: Any idea's how I can force the index to be scaned instead of the table?
: Or any better ways to do this query? If it helps the load_id column
: can be alphanumeric but my input will always be numeric only.

A rather weird way of doing it which might just work: Create function-based indexes on substr(load_id,2), substr(load_id,3), ... and rewrite your query as

Select (some stuff) From a
where
( load_id like '7339%' or substr(load_id,2) like '7339%' or ... )  And other columns = values

   Peter

-- 
Peter Marksteiner
Vienna University Computer Center
Received on Sat Mar 19 2005 - 06:02:38 CST

Original text of this message

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