Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E1CE7650523 for ; Fri, 18 Jul 2008 01:43:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97524-03-3 for ; Fri, 18 Jul 2008 01:42:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5FBD96502BB for ; Fri, 18 Jul 2008 01:37:40 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m6I4bVAf009920; Fri, 18 Jul 2008 00:37:31 -0400 (EDT) To: Jeff Frost cc: pgsql-performance@postgresql.org Subject: Re: index scan cost In-reply-to: References: Comments: In-reply-to Jeff Frost message dated "Thu, 17 Jul 2008 14:21:09 -0700" Date: Fri, 18 Jul 2008 00:37:31 -0400 Message-ID: <9919.1216355851@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.039 tagged_above=0 required=5 tests=AWL=0.039 X-Spam-Level: X-Archive-Number: 200807/144 X-Sequence-Number: 30744 Jeff Frost writes: > I have two postgresql servers. One runs 8.3.1, the other 8.3.3. On the 8.3.1 > machine, the index scans are being planned extremely low cost: > Index Scan using ix_email_entity_thread on email_entity (cost=0.00..4.59 > rows=1 width=1031) (actual time=0.095..0.120 rows=4 loops=1) > Index Cond: (email_thread = 375629157) > Index Scan using ix_email_entity_thread on email_entity (cost=0.00..2218.61 > rows=1151 width=931) (actual time=0.094..0.111 rows=4 loops=1) > Index Cond: (email_thread = 375629157) This isn't a "cost" problem, this is a "stats" problem. Why does the second server think 1151 rows will be returned? Try comparing the pg_stats entries for the email_thread column on both servers ... seems like they must be significantly different. regards, tom lane