Re: LIKE search and performance

From: "Andy" <frum(at)ar-sd(dot)net>
To: "'Rigmor Ukuhe'" <rigmor(dot)ukuhe(at)finestmedia(dot)ee>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: LIKE search and performance
Date: 2007-05-24 07:03:42
Message-ID: 002101c79dd1$aa0f8ce0$0b00a8c0@mpsro.dom
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thank you all for the answers.
I will try your suggestions and see what that brings in terms of
performance.

Andy.

> -----Original Message-----
> From: pgsql-performance-owner(at)postgresql(dot)org
> [mailto:pgsql-performance-owner(at)postgresql(dot)org] On Behalf Of
> Rigmor Ukuhe
> Sent: Wednesday, May 23, 2007 6:52 PM
> Cc: pgsql-performance(at)postgresql(dot)org
> Subject: Re: [PERFORM] LIKE search and 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.
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message James Mansion 2007-05-24 18:50:29 Re: LIKE search and performance
Previous Message Heikki Linnakangas 2007-05-24 04:27:27 Re: max_fsm_pages, shared_buffers and checkpoint_segments