Re: Working with huge amount of data. - Mailing list pgsql-general

From Jeff
Subject Re: Working with huge amount of data.
Date
Msg-id 2D8FB4EC-1F6A-44BE-9992-7EFC77532D44@torgo.978.org
Whole thread Raw
In response to Working with huge amount of data.  (Mario Lopez <mario@lar3d.com>)
List pgsql-general
On Feb 11, 2008, at 10:37 AM, Mario Lopez wrote:

> SELECT * FROM names WHERE name LIKE ‘keyword%’

If you use the C locale, PG can use an index for this query
> Or
> SELECT * FROM names WHERE name LIKE ‘%keyword%’
>

But not this one - substring searches are painful.

However, there is some hope - you can checkout the pg_trgm module
which provides trigrams and indexing methods so '%foo%'  type
searches can be done very quickly.

Things like google don't usually index substrings, just full words,
which makes life easier.  They may also use trigrams and other things
of that nature if they need to do subtrings (trigrams can also be
used to provide "Did you mean...." results.

--
Jeff Trout <jeff@jefftrout.com>
www.dellsmartexitin.com
www.stuarthamm.net






pgsql-general by date:

Previous
From: "INDIANNIC-HOSTING"
Date:
Subject: INDIANNIC : POSTGRES WINDOWS INSTALLATION
Next
From: Tom Lane
Date:
Subject: Re: ERROR: expected just one rule action