Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 82F29632331 for ; Mon, 30 Aug 2010 13:23:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 33527-10 for ; Mon, 30 Aug 2010 16:22:54 +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 67696632CB7 for ; Mon, 30 Aug 2010 13:22:54 -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 o7UGMr8s011112; Mon, 30 Aug 2010 12:22:53 -0400 (EDT) To: Gerhard Wiesinger cc: Pavel Stehule , Andreas Kretschmer , pgsql-performance@postgresql.org Subject: Re: Major performance problem after upgrade from 8.3 to 8.4 In-reply-to: References: <20100830072230.GA28373@tux> Comments: In-reply-to Gerhard Wiesinger message dated "Mon, 30 Aug 2010 18:11:36 +0200" Date: Mon, 30 Aug 2010 12:22:53 -0400 Message-ID: <11111.1283185373@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/331 X-Sequence-Number: 40174 Gerhard Wiesinger writes: > I know the drawbacks of an EAV design but I don't want to discuss that. I > want to discuss the major performance decrease of PostgreSQL 8.3 > (performance was ok) to PostgreSQL 8.4 (performance is NOT ok). > Any further ideas how I can track this down? > Can someone explain the difference in query plan from an optimizer point > of view? Since you haven't shown us the 8.3 plan, it's kind of hard to speculate ;-) One thing that jumped out at me was that 8.4 appears to be expecting multiple matches in each of the left-joined tables, which is why the total rowcount estimate balloons so fast. I rather imagine that you are expecting at most one match in reality, else the query isn't going to behave nicely. Is this correct? Are you *sure* you analyzed all these tables? And if that is how the data looks, where is the actual performance problem? A bad rowcount estimate isn't in itself going to kill you. FWIW, in a similar albeit toy example, I don't see any difference between the 8.3 and 8.4 plans or cost estimates. regards, tom lane