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: The LIKE Clause and the optimizer!

Re: The LIKE Clause and the optimizer!

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 25 Nov 1999 19:47:50 -0000
Message-ID: <943559531.21180.0.nnrp-07.9e984b29@news.demon.co.uk>

Why do you find it hard to believe.

A couple of side-issues:

    Your hint has a space between the /* and the +     so it is a comment not a hint.

    You haven't listed the columns you want     to select from the table - different options     may result in different access paths.

--

Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk

George wrote in message <81iajg$27n$1_at_perki.connect.com.au>...
>I have a query:
> SELECT /* + INDEX(invoices inv_num) */
> FROM invoices
> where inv_num LIKE '%xxxx'
>
>inv_num is of VARCHAR2(10) type and has an index on it.
>
>I am aware that Oracle will choose to do a FULL TABLE SCAN because
>the character string contains a '%' as the first letter, however I find it
>hard to believe that
>Oracle would rather use a full table scan rather than use the index in this
>case.
>The table contains around 50000 records and has 15 fields. Query using
>cost-based optimizer.
>
>Is there a way to force the optimzer to use the index?
>
>Using Oracle 8.0.5 on WindowsNT 4 SP4
>
>Thanks in advance
>
>George
>
>
Received on Thu Nov 25 1999 - 13:47:50 CST

Original text of this message

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