Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaOZS-00078z-Ls for pgsql-performance@arkaria.postgresql.org; Wed, 04 Nov 2020 19:35:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kaOZP-0002ZO-Rw for pgsql-performance@arkaria.postgresql.org; Wed, 04 Nov 2020 19:35:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaOZP-0002ZF-FS for pgsql-performance@lists.postgresql.org; Wed, 04 Nov 2020 19:35:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaOZN-0002Mv-Jm for pgsql-performance@lists.postgresql.org; Wed, 04 Nov 2020 19:35:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0A4JZiso1238446; Wed, 4 Nov 2020 14:35:44 -0500 From: Tom Lane To: Eric Raskin cc: pgsql-performance@lists.postgresql.org Subject: Re: Adding nextval() to a select caused hang/very slow execution In-reply-to: References: <1234726.1604513058@sss.pgh.pa.us> <1237035.1604516511@sss.pgh.pa.us> <1237916.1604517808@sss.pgh.pa.us> Comments: In-reply-to Eric Raskin message dated "Wed, 04 Nov 2020 14:25:00 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1238444.1604518544.1@sss.pgh.pa.us> Date: Wed, 04 Nov 2020 14:35:44 -0500 Message-ID: <1238445.1604518544@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ... btw, it occurs to me that at least as a stopgap, "set enable_nestloop = off" would be worth trying. The killer problem with rowcount-1 estimates is that they encourage the planner to use nestloops when it shouldn't. regards, tom lane