Re: LIKE and INDEX

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jie Liang <jie(at)stbernard(dot)com>
Cc: pgsql(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: LIKE and INDEX
Date: 2004-05-05 18:12:38
Message-ID: 40992E96.5090301@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Paul Tuckfield 2004-05-05 18:13:11 Re: very high CPU usage in "top", but not in "mpstat"
Previous Message Rod Taylor 2004-05-05 17:31:45 Re: LIKE and INDEX