X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6EE78329CB0 for ; Fri, 24 Sep 2004 18:07:09 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46286-01 for ; Fri, 24 Sep 2004 17:06:59 +0000 (GMT) Received: from mail.musicrebellion.com (dsl093-203-229.ind1.dsl.speakeasy.net [66.93.203.229]) by svr1.postgresql.org (Postfix) with ESMTP id 3FE1A329C65 for ; Fri, 24 Sep 2004 18:06:57 +0100 (BST) Received: from [10.0.1.102] (helo=musicrebellion.com ident=kris) by mail.musicrebellion.com with asmtp (Exim 4.34 #1 (Debian)) id 1CAtX4-0001Ps-3B for ; Fri, 24 Sep 2004 12:06:54 -0500 Message-ID: <4154542F.3000909@musicrebellion.com> Date: Fri, 24 Sep 2004 12:06:55 -0500 From: Kris Kiger User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 X-Accept-Language: en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: tsearch2 poor performance Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/231 X-Sequence-Number: 14934 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 | Indexes: "vector_idx" gist (vector) Triggers: 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'); count -------- 226357 (1 row) Time: 191056.230 ms search_test=# select count(*) from product where vector @@ to_tsquery('hydrogen'); count -------- 226868 (1 row) Time: 306411.957 ms search_test=# select count(*) from product where description like '% oil %'; count -------- 226357 (1 row) Time: 38426.851 ms search_test=# select count(*) from product where description like '% hydrogen %'; count -------- 226868 (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! Kris