Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 9795F9ED580 for ; Wed, 7 Dec 2011 05:37:12 -0400 (AST) Received: from out1.mail.amis.hr ([188.129.0.4]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RYDw6-0007y7-TX for pgsql-performance@postgresql.org; Wed, 07 Dec 2011 09:37:12 +0000 Received: from out.fsec.sm.srv.amis.hr (out.fsec.sm.srv.amis.hr [192.168.106.22]) by out1.mail.amis.hr (Postfix) with ESMTP id 2C0821FCAB for ; Wed, 7 Dec 2011 10:36:58 +0100 (CET) Received: from pps.filterd (out [127.0.0.1]) by out.fsec.sm.srv.amis.hr (8.14.3/8.14.3) with SMTP id pB79T0W3031345 for ; Wed, 7 Dec 2011 10:36:57 +0100 Received: from smtp.amis.hr (smtp.sm.srv.amis.hr [192.168.106.39]) by out.fsec.sm.srv.amis.hr with ESMTP id 11j3tg02u1-2 for ; Wed, 07 Dec 2011 10:36:56 +0100 A-Original-Client-UID: 188.129.68.200 splivalo Received: from [192.168.10.1] (cpe-188-129-68-200.dynamic.amis.hr [188.129.68.200]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: splivalo) by smtp.amis.hr (Postfix) with ESMTPSA id 86381270 for ; Wed, 7 Dec 2011 10:36:56 +0100 (CET) Message-ID: <4EDF3340.1030403@megafon.hr> Date: Wed, 07 Dec 2011 10:34:56 +0100 From: Mario Splivalo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Different query plans on same servers References: <4EDE717A.9050604@megafon.hr> <14289.1323201649@sss.pgh.pa.us> In-Reply-To: <14289.1323201649@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2011-12-07_03:2011-12-07, 2011-12-07, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1012030000 definitions=main-1112070020 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201112/56 X-Sequence-Number: 45855 On 12/06/2011 09:00 PM, Tom Lane wrote: > Mario Splivalo writes: >> I have 8.4.8 on producion and 8.4.9 on test, could that explain the >> difference in plans chosen? > > I'd wonder first if you have the same statistics settings on both. > The big problem here is that the estimation of the join size is bad > (8588 versus 0). Just an update here. I did downgrade postgres on testbox to 8.4.8 and now it's choosing bad plan there too. So we upgraded postgres on production server and the bad plan went away. We're preparing for upgrade to 9.1 now, we hope to offload some of the SELECTs to the slave server, we'll see how that will work. Thank you for your inputs! Mario