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

Home -> Community -> Usenet -> c.d.o.server -> Re: wildcard search and full tablescans

Re: wildcard search and full tablescans

From: hpuxrac <johnbhurley_at_sbcglobal.net>
Date: 7 Dec 2006 05:52:53 -0800
Message-ID: <1165499573.871955.97400@l12g2000cwl.googlegroups.com>

wagen123_at_yahoo.com wrote:
> Oracle10g 10.2.0.1
>
> select * from <table_name> where <column_name> like '%abc%';
>
> does not use the index and does a full tablescan (guess this is the
> expected behaviour as per explain plan).
>
> Any suggestions as to how to use the index (index hint didn't help), IF
> possible or other alternatives.
>
> thanks

If you CANNOT begin the search with some leading characters ( not the percent sign ) ... ie where some_col like 'abc%' ... then normally I would expect to the optimizer to pick either a full table scan or some kind of index scan.

You might want to do a 10053 trace and some analysis of where the optimizer is going with your query.

You can put in a hint like this select /*+ INDEX(table_or_view_name optional_index_name) */ column_list FROM etc ...

Eiher a full table scan or a full index scan ( of some type ) produces an application that has scalability limitations built into it. ( Your logical IO's are very high ).

For full searching within a column there are options including the TEXT indexes but they have some complications ( different SQL where syntax, maintenance and cpu implications etc ).

Oracle will work nicely with regular character indexes IF you put a where clause and a like that DOESN'T start with a percent sign. Received on Thu Dec 07 2006 - 07:52:53 CST

Original text of this message

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