Re: LIKE and INDEX - Mailing list pgsql-performance

From Richard Huxton
Subject Re: LIKE and INDEX
Date
Msg-id 40992E96.5090301@archonet.com
Whole thread Raw
In response to LIKE and INDEX  ("Jie Liang" <jie@stbernard.com>)
List pgsql-performance
Jie Liang wrote:
> All,
> This is old topic, when I use:
> select url from urlinfo where url like 'http://www.lycos.de%';
> it uses the index, good!
>
> but if I use:
> select url from urlinfo where url like 'http://%.lycos.de';
> it won't use index at all, NOT good!
> is there any way I can force secon query use index???

I've seen people define a reverse(text) function via plperl or similar
then build a functional index on reverse(url). Of course, that would
rely on your knowing which end of your search pattern has the % wildcard.

--
   Richard Huxton
   Archonet Ltd

pgsql-performance by date:

Previous
From: Paul Tuckfield
Date:
Subject: Re: very high CPU usage in "top", but not in "mpstat"
Next
From: Rod Taylor
Date:
Subject: Re: LIKE and INDEX