Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qu0hX-00FbQV-Ev for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Oct 2023 01:22:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qu0hV-00Akju-3p for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Oct 2023 01:22:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qu0hU-00Akjl-RG for pgsql-bugs@lists.postgresql.org; Sat, 21 Oct 2023 01:22:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qu0hS-001oo2-Hb for pgsql-bugs@lists.postgresql.org; Sat, 21 Oct 2023 01:22:48 +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 39L1Meen4020108; Fri, 20 Oct 2023 21:22:41 -0400 From: Tom Lane To: ruslan.ganeev@list.ru cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18166: 100 Gb 18000000 records table update In-reply-to: <18166-8d0f3718572475ef@postgresql.org> References: <18166-8d0f3718572475ef@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 20 Oct 2023 22:09:18 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <4020106.1697851360.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 20 Oct 2023 21:22:40 -0400 Message-ID: <4020107.1697851360@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > We tried to make a script, which sets enddate = '2022-12-31' for all > records, having the value in «DataVip» that is not maximal. For other > records the script set s enddate = null > The problem is that the script is running for 6 hours, the main percentage > of time is taken by the rebuilding of indexes. This is not a bug. However ... a common workaround for bulk updates like that is to drop all the table's indexes and then recreate them afterwards. It's often quicker than doing row-by-row index updates. regards, tom lane