Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gxFD4-0004Dh-Hh for pgsql-performance@arkaria.postgresql.org; Fri, 22 Feb 2019 18:06:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gxFD2-0001n1-Eh for pgsql-performance@arkaria.postgresql.org; Fri, 22 Feb 2019 18:06:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gxFD2-0001mu-3h for pgsql-performance@lists.postgresql.org; Fri, 22 Feb 2019 18:06:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gxFCz-0001ls-PW for pgsql-performance@postgresql.org; Fri, 22 Feb 2019 18:06:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1MI5x4o017804; Fri, 22 Feb 2019 13:05:59 -0500 From: Tom Lane To: Michael Lewis cc: kimaidou , Justin Pryzby , postgres performance list Subject: Re: Aggregate and many LEFT JOIN In-reply-to: References: <20190222155415.GE28750@telsasoft.com> Comments: In-reply-to Michael Lewis message dated "Fri, 22 Feb 2019 10:18:02 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17802.1550858759.1@sss.pgh.pa.us> Date: Fri, 22 Feb 2019 13:05:59 -0500 Message-ID: <17803.1550858759@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Lewis writes: > Does the plan change significantly with this- > set session work_mem='250MB'; > set session geqo_threshold = 20; > set session join_collapse_limit = 20; Yeah ... by my count there are 16 tables in this query, so raising join_collapse_limit to 15 is not enough to ensure that the planner considers all join orders. Whether use of GEQO is a big problem is harder to say, but it might be. regards, tom lane