pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Jie Liang <jie@stbernard.com>
Cc: pgsql@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: LIKE and INDEX
Date: Wed, 05 May 2004 19:12:38 +0100
Message-ID: <40992E96.5090301@archonet.com> (raw)
In-Reply-To: <E7E213858379814A9AE48CA6754F5ECB36335D@mail01.stbernard.com>
References: <E7E213858379814A9AE48CA6754F5ECB36335D@mail01.stbernard.com>

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



view thread (3+ messages)

Message-ID: <40992E96.5090301@archonet.com>
Permalink:  ../40992E96.5090301@archonet.com/
Also on:    postgresql.org/message-id/40992E96.5090301@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dev@archonet.com, jie@stbernard.com, pgsql@postgresql.org
  Subject: Re: LIKE and INDEX
  In-Reply-To: <40992E96.5090301@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox