pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rigmor Ukuhe <rigmor.ukuhe@finestmedia.ee>
Cc: pgsql-performance@postgresql.org
Subject: Re: LIKE search and performance
Date: Wed, 23 May 2007 18:52:21 +0300
Message-ID: <46546335.5000109@finestmedia.ee> (raw)
In-Reply-To: <009501c79d4c$445428f0$0b00a8c0@mpsro.dom>
References: <009501c79d4c$445428f0$0b00a8c0@mpsro.dom>

Andy wrote:
> Hi,
>  
> I have a table with varchar and text columns, and I have to search 
> through these text in the whole table.
>  
> An example would be:
> SELECT * FROM table
>                              WHERE name like '%john%' or street like '%srt%'
>  
> Anyway, the query planner always does seq scan on the whole table and 
> that takes some time. How can this be optimized or made in another way 
> to be faster?

Use tsearch2 (http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/) for full text indexing.

Rigmor

>  
> I tried to make indexes on the columns but no success.
>  
> PG 8.2
>  
> Regards,
> Andy.






view thread (29+ messages)  latest in thread

Message-ID: <46546335.5000109@finestmedia.ee>
Permalink:  ../46546335.5000109@finestmedia.ee/
Also on:    postgresql.org/message-id/46546335.5000109@finestmedia.ee

 · 

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: rigmor.ukuhe@finestmedia.ee
  Subject: Re: LIKE search and performance
  In-Reply-To: <46546335.5000109@finestmedia.ee>

* 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