Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9D8B8B5DC3E for ; Wed, 24 Aug 2011 00:16:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 36416-09-2 for ; Wed, 24 Aug 2011 03:15:57 +0000 (UTC) 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 mail.postgresql.org (Postfix) with ESMTP id 1CC34B5DCEB for ; Wed, 24 Aug 2011 00:15:44 -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 p7O3FeFt015709; Tue, 23 Aug 2011 23:15:41 -0400 (EDT) To: Mark Kirkwood cc: PGSQL Performance Subject: Re: 8.4 optimization regression? In-reply-to: <4E5331FF.3000900@catalyst.net.nz> References: <4E5331FF.3000900@catalyst.net.nz> Comments: In-reply-to Mark Kirkwood message dated "Tue, 23 Aug 2011 16:52:15 +1200" Date: Tue, 23 Aug 2011 23:15:40 -0400 Message-ID: <15708.1314155740@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.405 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.505 X-Spam-Level: X-Archive-Number: 201108/256 X-Sequence-Number: 44703 Mark Kirkwood writes: > I am in the progress of an 8.3 to 8.4 upgrade for a customer. I seem to > have stumbled upon what looks like a regression. The two databases > (8.3.14 and 8.4.8) have identical tuning parameters (where that makes > sense) and run on identical hardware. Both databases are regularly > vacuumed and analyzed (not by autovacuum), and performing an ANALYZE > does not change the plans shown below. Hmmm ... this is structurally a pretty simple query, so I'm surprised that 8.3 and 8.4 see it very much differently. The relation-level estimates and plan choices are very nearly the same; the only thing that's changed much is the estimates of the join sizes, and there were not that many changes in the join selectivity estimation for simple inner joins. I wonder whether you are seeing a bad side-effect of this patch: http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=7f3eba30 That code would only be reached when one or both join columns lack MCV lists in pg_stats; if you had analyzed, the only reason for that to be the case is if the column is unique (or nearly so, in ANALYZE's opinion). regards, tom lane