Re: indexes for ILIKE

From: Brendan Duddridge <brendan(at)clickspace(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Ilja Golshtein <ilejn(at)yandex(dot)ru>, pgsql-general(at)postgresql(dot)org
Subject: Re: indexes for ILIKE
Date: 2006-02-15 17:40:39
Message-ID: F58DC308-9484-4EBC-A398-EE3F8A630C2F@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

We tried this recently. You have to use lower(a) like lower(b) for
the index to work.

____________________________________________________________________
Brendan Duddridge | CTO | 403-277-5591 x24 | brendan(at)clickspace(dot)com

ClickSpace Interactive Inc.
Suite L100, 239 - 10th Ave. SE
Calgary, AB T2G 0V9

http://www.clickspace.com

On Feb 13, 2006, at 5:42 AM, Martijn van Oosterhout wrote:

> On Mon, Feb 13, 2006 at 03:33:34PM +0300, Ilja Golshtein wrote:
>> Hello!
>>
>> Is there any way to use an index to pick up text field
>> start from a substring?
>> I need to ignore case of characters and encoding I use is UTF-8.
>>
>> I am aware of text_pattern_ops and stuff, though
>> FAQ says ILIKE does not use indexes.
>
> You at the very least would need a text_pattern_ops index on
> lower(colname). At that, I'm not sure whether it would work or whether
> you need to rephrase your query as:
>
> lower(a) like lower(b)
>
> Hope this helps,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/
> kleptog/
>> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent
>> is a
>> tool for doing 5% of the work and then sitting around waiting for
>> someone
>> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-02-15 17:46:45 Re: vacuumdb out of memory error
Previous Message Merlin Moncure 2006-02-15 17:25:07 Re: Postgres using 100% CPU