Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 392EC19713C6 for ; Tue, 6 Dec 2011 16:17:48 -0400 (AST) Received: from gwmta.wicourts.gov ([165.219.244.99] helo=gw.wicourts.gov) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RY1SV-00042W-C5 for pgsql-performance@postgresql.org; Tue, 06 Dec 2011 20:17:48 +0000 Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Tue, 06 Dec 2011 14:17:34 -0600 Message-Id: <4EDE23FA020000250004393F@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Tue, 06 Dec 2011 14:17:30 -0600 From: "Kevin Grittner" To: "Mario Splivalo" Cc: "pgsql-performance@postgresql.org" , "Tom Lane" Subject: Re: Different query plans on same servers References: <4EDE717A.9050604@megafon.hr><4EDE717A.9050604@megafon.hr> <14289.1323201649@sss.pgh.pa.us> In-Reply-To: <14289.1323201649@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Pg-Spam-Score: -5.4 (-----) X-Archive-Number: 201112/47 X-Sequence-Number: 45846 Tom Lane wrote: > 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). But both servers develop that estimate for the join size. I was wondering more about whether the costing factors were really the same: slow: -> Nested Loop (cost=0.00..792824.51 rows=8588 width=275) (actual time=3269.997..3269.997 rows=0 loops=1) versus fast: -> Hash Join (cost=857.00..31152.80 rows=8588 width=275) (actual time=37.968..37.968 rows=0 loops=1) The hash join path must look more expensive on the first machine, for some reason. Mario, could you post the result of running this query from both servers?: http://wiki.postgresql.org/wiki/Server_Configuration -Kevin