Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3A0512E012C for ; Sun, 24 Feb 2008 13:50:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 86897-03 for ; Sun, 24 Feb 2008 13:50:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0B3282E010A for ; Sun, 24 Feb 2008 13:50:31 -0400 (AST) 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 m1OHoVBB005290; Sun, 24 Feb 2008 12:50:31 -0500 (EST) To: Sean Leach cc: pgsql-performance Subject: Re: Weird issue with planner choosing seq scan In-reply-to: References: Comments: In-reply-to Sean Leach message dated "Sun, 24 Feb 2008 07:40:54 -0800" Date: Sun, 24 Feb 2008 12:50:31 -0500 Message-ID: <5289.1203875431@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/304 X-Sequence-Number: 28846 Sean Leach writes: > I have a table, that in production, currently has a little over 3 > million records in production. In development, the same table has > about 10 million records (we have cleaned production a few weeks > ago). You mean the other way around, to judge by the rowcounts from EXPLAIN. > -> Index Scan using u_counts_i2 on u_counts c > (cost=0.00..53.53 rows=1082 width=4) (actual time=0.277..1224.582 > rows=392173 loops=1) I kinda think the devel system wouldn't be using an indexscan either if it had up-to-date ANALYZE statistics. But even with the 1082 row estimate that seems a remarkably low cost estimate. Have you been playing games with random_page_cost? Maybe you forgot to duplicate the devel system's cost parameters onto the production system? regards, tom lane