Re: pg_trgm performance - Mailing list pgsql-performance

From Guillaume Smet
Subject Re: pg_trgm performance
Date
Msg-id 1d4e0c10702231509k7ad24e2ck3a149a2e3a2899f7@mail.gmail.com
Whole thread Raw
In response to Re: pg_trgm performance  ("Steinar H. Gunderson" <sgunderson@bigfoot.com>)
Responses Re: pg_trgm performance  ("Steinar H. Gunderson" <sgunderson@bigfoot.com>)
List pgsql-performance
Florian, Steinar,

Could you try to see if the GIN implementation of pg_trgm is faster in
your cases?

Florian, instead of using WHERE similarity(...) > 0.4, you should use
set_limit (SELECT set_limit(0.4);).

I posted it on -patches and it is available here:
http://people.openwide.fr/~gsmet/postgresql/pg_trgm_gin3.diff .

The patch is against HEAD but It applies on 8.2 without any problem.

After applying this patch and installing pg_trgm.sql (you should
uninstall pg_trgm before compiling using the old uninstall script),
then you can create:
CREATE INDEX idx_table_word ON table USING gin(word gin_trgm_ops);

17 characters is quite long so I'm not sure it will help you because
it usually has to recheck a high number of rows due to the GIN
implementation but I'd like to know if it's faster or slower in this
case.

If your data are not private and you don't have the time to test it, I
can test it here without any problem.

Thanks.

--
Guillaume

pgsql-performance by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: long checkpoint_timeout
Next
From: "Steinar H. Gunderson"
Date:
Subject: Re: pg_trgm performance