Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C13B29FA50F for ; Mon, 9 Apr 2007 06:09:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 53000-03 for ; Mon, 9 Apr 2007 06:09:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.225]) by postgresql.org (Postfix) with ESMTP id CAF559FA4BB for ; Mon, 9 Apr 2007 06:09:54 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 50so789699wri for ; Mon, 09 Apr 2007 02:09:53 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=SG4EYN15K823FrAGA4wT3eSxlRZpSj+rHhDpkFwhgOdwJ6iR2sKSGfaLdcRqZHIbdUKvCdAW30TaywxX5Ux9QGXrU4j3n+wKKw1o5kLxHmb8FWhn1h+9O7xx8eapkwJDa+XqrCjtlHPBe6j0x6XFWpjml/IN0RLYJGD+l28jmnw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=sYhEjiblNsy0+TKxHX/G4JXsyTJH13QS+b9Uq+99Tnd0jL2Aw7lTSKTbsZ/0qDjiYe/JErWWxdt0JgGWJFwXUX33t0pf9ss6X8g/2vPmBGkjZ1255FcTuEuJo8OnOqS+3TPgTw7c3/ZzaGDSjuceur5TIxLslybZqx275vg75uU= Received: by 10.114.110.1 with SMTP id i1mr2251720wac.1176109793302; Mon, 09 Apr 2007 02:09:53 -0700 (PDT) Received: by 10.114.93.14 with HTTP; Mon, 9 Apr 2007 02:09:53 -0700 (PDT) Message-ID: <24b53fa00704090209pcdd2c6cof487d6388c1743b8@mail.gmail.com> Date: Mon, 9 Apr 2007 02:09:53 -0700 From: "s d" To: pgsql-performance@postgresql.org Subject: Beginner Question MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/203 X-Sequence-Number: 24080 Hi, I am trying to figure out how to debug a performance problem / use psql explain. The table in question is: # \d word_association; Table "public.word_association" Column | Type | Modifiers --------+------------------------+-------------------- word1 | character varying(128) | not null word2 | character varying(128) | not null count | integer | not null default 0 Indexes: "word1_word2_comb_unique" unique, btree (word1, word2) "word1_hash_index" hash (word1) "word2_hash_index" hash (word2) "word_association_count_index" btree (count) "word_association_index1_1" btree (word1) "word_association_index2_1" btree (word2) It has multiple indices since i wanted to see which one the planner choses. # explain select * FROM word_association WHERE (word1 = 'bdss' OR word2 = 'bdss') AND count >= 10; QUERY PLAN ------------------------------------------------------------------------------------------------ Bitmap Heap Scan on word_association (cost=11.53..1192.09 rows=155 width=22) Recheck Cond: (((word1)::text = 'bdss'::text) OR ((word2)::text = 'bdss'::text)) Filter: (count >= 10) -> BitmapOr (cost=11.53..11.53 rows=364 width=0) -> Bitmap Index Scan on word_association_index1_1 (cost=0.00..5.79 rows=190 width=0) Index Cond: ((word1)::text = 'bdss'::text) -> Bitmap Index Scan on word_association_index2_1 (cost=0.00..5.67 rows=174 width=0) Index Cond: ((word2)::text = 'bdss'::text) (8 rows) The questions: 1. i can undestand where the cost=11.53 came from but where did the 1192.09 come form? The values are in milli right ? 2. the query takes in reality much longer than 1 second. In short, it feels like something is very wrong here (i tried vacuum analyze and it didn't do much diff). any ideas ?