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 1spCEG-00HKry-Ok for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Sep 2024 19:45:17 +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 1spCEG-00AgIc-1Q for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Sep 2024 19:45:16 +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 1spCEF-00AgHs-OZ for pgsql-bugs@lists.postgresql.org; Fri, 13 Sep 2024 19:45:15 +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 1spCEC-0012OP-5o for pgsql-bugs@lists.postgresql.org; Fri, 13 Sep 2024 19:45:15 +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 48DJjBWN125360; Fri, 13 Sep 2024 15:45:11 -0400 From: Tom Lane To: Alexander Lakhin cc: Pavel Borisov , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18616: Long-running hash index build can not be interrupted In-reply-to: <122464.1726255346@sss.pgh.pa.us> References: <18616-acbb9e5caf41e964@postgresql.org> <20a57c76-7aaf-a641-add3-147541a4dccf@gmail.com> <122464.1726255346@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 13 Sep 2024 15:22:26 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <125358.1726256711.1@sss.pgh.pa.us> Date: Fri, 13 Sep 2024 15:45:11 -0400 Message-ID: <125359.1726256711@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Looking at hashbuild, the effective sort_threshold depends on > NBuffers, so maybe if you have that set to a high enough value > it fails to go into the sort path? If I use > SET maintenance_work_mem = '128MB'; > instead of the suggested 1GB, I don't see the problem. Oh, false alarm: that test in hashbuild takes basically the min of maintenance_work_mem and NBuffers, so that with default NBuffers of 128MB, there's no difference here between those two settings. The reason I see a difference in behavior seems to be that with maintenance_work_mem = 1GB, the tuple sorting step completes faster, allowing control to reach _h_indexbuild before the 10sec timeout I was testing with. With the smaller maintenance_work_mem setting, we're still sorting when it times out --- and there are CHECK_FOR_INTERRUPTS calls in the sort code. regards, tom lane