Re: Trigram performance penalty on varchar? - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Trigram performance penalty on varchar?
Date
Msg-id 9E5E1046-8144-4522-BC21-2511CEFC15C4@solfertje.student.utwente.nl
Whole thread Raw
In response to Trigram performance penalty on varchar?  (Mario Lopez <mario@lar3d.com>)
List pgsql-general
On Feb 21, 2008, at 10:56 AM, Mario Lopez wrote:

> Hi,
>
> I am indexing a 100 million record table composed of varchar(255)
> as the field to be indexed. I have always seen that examples of
> pg_trgm are based on text type fields. Is this by any special reason?.

A varchar is internally represented as text, with a size constraint
of 255 characters in your case (I'm assuming your data requires that
constraint?).

> My computer is creating the index since 5 hours ago so I guess
> there must be something wrong...

I guess your server is running low on memory and the index being
created doesn't fit in memory. You may want to have a look at http://
www.postgresql.org/docs/8.3/interactive/populate.html#POPULATE-WORK-MEM

Another reason may be an exclusive lock on a row that you're trying
to index, but that would mean that some transaction on some client
somewhere is keeping that lock for a very long time (should not
happen). You can check the pg_locks and pg_stat_activity tables for
that.

Regards,
Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,47c159af233092392031086!



pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Regex query not using index
Next
From: Alban Hertroys
Date:
Subject: Re: How to make update rapidly?