Skip site navigation (1) Skip section navigation (2)

tsearch2 poor performance

From: Kris Kiger <kris(at)musicrebellion(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: tsearch2 poor performance
Date: 2004-09-24 17:06:55
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Hi all.  I am doing some work with tsearch2 and am not sure what to 
expect out of it, performance wise.  Here is my setup:

                          Table "public.product"
   Column    |   Type   |                    Modifiers
 description | text     |
 product_id  | integer  | default nextval('product_product_id_seq'::text)
 vector      | tsvector |
    "vector_idx" gist (vector)
    tsvectorupdate BEFORE INSERT OR UPDATE ON product FOR EACH ROW EXECUTE PROCEDURE tsearch2('vector', 'description')

This table has 3,000,000 rows in it.  Each description field has roughly 50 characters.  There are fewer than ten thousand distinct words in my 3,000,000 rows.  The vector was filled using the description fields values.  I ran a vacuum full analyze before executing any of my queries.  

Here are a couple of tests I performed using the tsearch index and like;

search_test=# select count(*) from product where vector @@ to_tsquery('oil');
(1 row)

Time: 191056.230 ms

search_test=# select count(*) from product where vector @@ to_tsquery('hydrogen');
(1 row)

Time: 306411.957 ms

search_test=# select count(*) from product where description like '% oil %';
(1 row)

Time: 38426.851 ms

search_test=# select count(*) from product where description like '% hydrogen %';
(1 row)

Time: 38265.421 ms

Both of the likes are using a sequential scan and both of the tsearch queries use the gist index.  Did I miss a configuration parameter, are these queries incorrectly using tsearch2,or is this tsearch2's average performance?  Thanks in advance for the input!  



pgsql-admin by date

Next:From: Oleg BartunovDate: 2004-09-24 17:20:36
Subject: Re: tsearch2 poor performance
Previous:From: Goulet, DickDate: 2004-09-24 15:06:14
Subject: Re: Porting from MS SQL Server to PostGres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group