Re: What index for 'like (%keyword%)' ???

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: "Priem, Alexander" <ap(at)cict(dot)nl>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: What index for 'like (%keyword%)' ???
Date: 2004-04-01 01:19:07
Message-ID: 406B6E0B.9050200@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> I am building a query which uses a clause like "Where doc_description like
> '%keyword%'". I know a normal index won't be of any use here, but since the
> table in question will get fairly big, I do want to use an index.
>
> Can anyone give me some advise on what kind of index I can use here? Or
> shouldn't I use one in this case?

You have to use a proper full text indexing scheme. Investigate
contrib/tsearch2 module in the postgres distribution.

Chirs

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gary Doades 2004-04-01 19:19:34 PostgreSQL and Linux 2.6 kernel.
Previous Message Gaetano Mendola 2004-03-31 23:26:53 linux and anotime mount option