Skip site navigation (1) Skip section navigation (2)

Re: optimizing LIKE '%2345' queries

From: Chris <dmagick(at)gmail(dot)com>
To: genekhart(at)gmail(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: optimizing LIKE '%2345' queries
Date: 2006-07-05 00:22:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Gene wrote:
> Thanks for the suggestion. Actually I went ahead and created a reverse
> function using plpgsql, created an index using reverse column and now
> my queries use "where reverse(column) like reverse('%2345') and it's
> using the index like i hoped it would! Now if I could figure out how
> to optimize like  '%2345%' queries. I don't want to create many
> indexes though the table is very write heavy.

You can't because that text can be anywhere inside the database field, 
so the whole field basically has to be checked to see if it's there.

You could check out full text indexing (tsearch2).

<shameless plug>

Postgresql & php tutorials

In response to

pgsql-performance by date

Next:From: jkapadDate: 2006-07-05 05:54:44
Subject: Problem with bitmap-index-scan plan
Previous:From: GeneDate: 2006-07-04 20:27:44
Subject: Re: optimizing LIKE '%2345' queries

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group