Re: INDEX and LIKE

From: "Olivier Hubaut" <olivier(at)scmbb(dot)ulb(dot)ac(dot)be>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: INDEX and LIKE
Date: 2004-11-29 13:45:42
Message-ID: opsh8a6gzu94ope3@olivier.amaze.ulb.ac.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, 29 Nov 2004 12:19:12 +0000, T E Schmitz
<mailreg(at)numerixtechnology(dot)de> wrote:

> Hello,
>
> I need to be able to perform wildcard searches on a VARCHAR(100) column
> of the form
>
> SELECT * FROM item WHERE serial_no LIKE '%12345678%'
>
> Would an index on serial_no do anything at all for this search?
>
No, It wouldn't. If you use "%" for the beginning of you search pattern, a
seqential search is performed, ignoring the index wich use the beginning
of the string in order to create it's B-tree.

--
Downloading signature ... 99%
*CRC FAILED*
signature aborted

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dave Steinberg 2004-11-29 16:19:30 Re: PG7.4.5: query not using index on date column
Previous Message T E Schmitz 2004-11-29 12:19:12 INDEX and LIKE