Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6D0239F9E50 for ; Sat, 6 Oct 2007 02:50:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 11358-07 for ; Sat, 6 Oct 2007 02:50:13 -0300 (ADT) 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 325E89F9535 for ; Sat, 6 Oct 2007 02:50:13 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l965o3Qa011262; Sat, 6 Oct 2007 01:50:03 -0400 (EDT) To: "Jeff Frost" cc: "'PostgreSQL Performance'" Subject: Re: query plan worse after analyze In-reply-to: <029201c807bc$f1642f60$120a0a0a@jefflap> References: <029201c807bc$f1642f60$120a0a0a@jefflap> Comments: In-reply-to "Jeff Frost" message dated "Fri, 05 Oct 2007 19:02:26 -0700" Date: Sat, 06 Oct 2007 01:50:03 -0400 Message-ID: <11261.1191649803@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/67 X-Sequence-Number: 27089 "Jeff Frost" writes: > Before analyze it seems to choose Bitmap Heap Scan on episodes > current_episode, but after it chooses Index Scan Backward using > index_episodes_on_publish_on on episodes current_episode. Have you tried raising the stats target for "episodes"? Seems like the problem is a misestimate of the frequency of matches for season_id = something. regards, tom lane