From: Andy <frum@ar-sd.net>
To: 'Rigmor Ukuhe' <rigmor.ukuhe@finestmedia.ee>
Cc: pgsql-performance@postgresql.org
Subject: Re: LIKE search and performance
Date: Thu, 24 May 2007 10:03:42 +0300
Message-ID: <002101c79dd1$aa0f8ce0$0b00a8c0@mpsro.dom> (raw)
In-Reply-To: <46546335.5000109@finestmedia.ee>
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@postgresql.org
> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of
> Rigmor Ukuhe
> Sent: Wednesday, May 23, 2007 6:52 PM
> Cc: pgsql-performance@postgresql.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
>
>
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: frum@ar-sd.net, rigmor.ukuhe@finestmedia.ee
Subject: Re: LIKE search and performance
In-Reply-To: <002101c79dd1$aa0f8ce0$0b00a8c0@mpsro.dom>
* 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