Re: Working with huge amount of data.

From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: Mario Lopez <mario(at)lar3d(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Working with huge amount of data.
Date: 2008-02-11 17:08:14
Message-ID: 2D8FB4EC-1F6A-44BE-9992-7EFC77532D44@torgo.978.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)jefftrout(dot)com>
www.dellsmartexitin.com
www.stuarthamm.net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-02-11 17:29:14 Re: ERROR: expected just one rule action
Previous Message Dave Page 2008-02-11 16:44:43 Re: ERROR: expected just one rule action