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 1jrXxW-0005k8-Js for pgsql-general@arkaria.postgresql.org; Sat, 04 Jul 2020 02:31:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jrXxV-0004Zq-HN for pgsql-general@arkaria.postgresql.org; Sat, 04 Jul 2020 02:31:17 +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 1jrXxV-0004Zj-9X for pgsql-general@lists.postgresql.org; Sat, 04 Jul 2020 02:31:17 +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 1jrXxO-0000wH-Ok for pgsql-general@postgresql.org; Sat, 04 Jul 2020 02:31:16 +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 0642V9M81154268; Fri, 3 Jul 2020 22:31:09 -0400 From: Tom Lane To: Mohamed Wael Khobalatte cc: pgsql-general@postgresql.org Subject: Re: Degraded performance during table rewrite In-reply-to: References: <1115603.1593811564@sss.pgh.pa.us> Comments: In-reply-to Mohamed Wael Khobalatte message dated "Fri, 03 Jul 2020 22:16:04 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1154266.1593829869.1@sss.pgh.pa.us> Date: Fri, 03 Jul 2020 22:31:09 -0400 Message-ID: <1154267.1593829869@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mohamed Wael Khobalatte writes: > Do you happen to know if there is an upper limit to how much time the > planner is willing to spend on this? There is not. (I have considered that idea, but it's not implemented. I'm not sure whether there's still much practical problem given the v11+ behavior, so I'm not in a hurry to complicate things more.) Another idea that might conceivably be useful to you on 9.6 is to reorganize the bulk deletions so that most of them aren't at the endpoint of the live id range. If you made it so that the extremal values are deleted last, you'd never hit this behavior. regards, tom lane