Re: How to speed up the search with OR criteria

From: Tony Damon <bfntd_at_aimnet.com>
Date: 1996/02/05
Message-ID: <4f588c$gc6_at_news2.aimnet.com>#1/1


G Martin (Sarek_at_cityscape.co.uk) wrote:
: Alan Tai <alantai> wrote:
:
: >I wonder how to speed up the response time of SQL statements like " SELECT *
: >FROM table1 WHERE field1 LIKE 'A%' OR field2 LIKE 'A%';" and " SELECT COUNT(*)
: >FROM table1 WHERE field1 LIKE 'A%' OR field2 LIKE 'A%';".
:
: The 'Like' statement is the problem - it *never* uses an index. If you
: need to handle this sort of stuff regularly consider building your own
: hash key for 'field1', 'field2' and using '=' instead of 'like'
:

I was under the impression 'like' _could_ use an index if the wildcard character was at the 'end' of the value ('xyz%') but not if it was at the beginning ('%xyz'). It had to do with the way Oracle stores and compresses/decompresses the values.

Tony Damon Received on Mon Feb 05 1996 - 00:00:00 CET

Original text of this message