Re: indexes for ILIKE

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Ilja Golshtein <ilejn(at)yandex(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: indexes for ILIKE
Date: 2006-02-13 12:42:39
Message-ID: 20060213124239.GC20796@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergey Karin 2006-02-13 13:13:20 PG and Tivoli Data Protection
Previous Message Ilja Golshtein 2006-02-13 12:33:34 indexes for ILIKE