Re: LIKE search and performance

From: Rigmor Ukuhe <rigmor(dot)ukuhe(at)finestmedia(dot)ee>
To:
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: LIKE search and performance
Date: 2007-05-23 15:52:21
Message-ID: 46546335.5000109@finestmedia.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Vivek Khera 2007-05-23 15:57:15 Re: does VACUUM ANALYZE complete with this error?
Previous Message Richard Huxton 2007-05-23 15:52:12 Re: LIKE search and performance