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 1iAEFB-0007MM-Hn for pgsql-performance@arkaria.postgresql.org; Tue, 17 Sep 2019 14:14:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAEFA-00084r-Cg for pgsql-performance@arkaria.postgresql.org; Tue, 17 Sep 2019 14:14:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAEEi-000556-Om for pgsql-performance@lists.postgresql.org; Tue, 17 Sep 2019 14:13:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAEEg-0004zR-JG for pgsql-performance@lists.postgresql.org; Tue, 17 Sep 2019 14:13:44 +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 x8HEDeCv000561; Tue, 17 Sep 2019 10:13:40 -0400 From: Tom Lane To: Bob Jolliffe cc: pgsql-performance@lists.postgresql.org Subject: Re: does max_connections affect the query planner In-reply-to: References: Comments: In-reply-to Bob Jolliffe message dated "Tue, 17 Sep 2019 08:40:53 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <559.1568729620.1@sss.pgh.pa.us> Date: Tue, 17 Sep 2019 10:13:40 -0400 Message-ID: <560.1568729620@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bob Jolliffe writes: > We do know that max_connections is set quite high (600) when we don't > really expect more than 100. I wonder does the planner take > max_connections x work_mem into account when considering the memory it > has potentially available? No. There have been discussions to the effect that it ought to have a more holistic view about available memory; but nothing's been done about that, and certainly no existing release does so. Usually the proximate cause of bad plan choices is bad rowcount estimates --- you can spot that by comparing estimated and actual rowcounts in EXPLAIN ANALYZE results. regards, tom lane