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 1rd0qH-003Oa0-8H for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Feb 2024 04:37:54 +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 1rd0qF-00866J-LW for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Feb 2024 04:37:52 +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 1rd0qF-00866A-7g for pgsql-hackers@lists.postgresql.org; Thu, 22 Feb 2024 04:37:51 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rd0qB-000HI6-Vs for pgsql-hackers@postgresql.org; Thu, 22 Feb 2024 04:37:50 +0000 Received: from [192.168.1.58] (unknown [1.20.173.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 3AA5FE20E9C; Thu, 22 Feb 2024 07:37:44 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1708576666; bh=qHSE918cEirSufPAauZDcaeaJIey6SjXak96tcjO7FE=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=tUkl9ANA8Am67RSFMOkLHS4LAeX6R0kHeW29RYOt6+M+a/1wI6WXjc8zquWo2iEWe tc5aRfILqZM0yN7IZc4S7rF4XNOOxgmXHdK0gih9k/+G9cx8DyNTcCHAf0B03kQnPA /mr16F+zwIyG/Bb3RJ4Y1LftdZR0Zdgey5KaumJ4L+Pf/oHdZaEQdtxOOuieAQDJ2H K0I+1poYz1NIDYCwE0GPjGuu0tCSxyAXTpB5X7bbaINGX04cdSNq8T6vkwd0Yk1W9d sTpNGXJRihw5+4vptgOumz/vziGhoFFCA9kmWZMkC1If3/XPO2SHd1vEJCUK0h5OmA 39C+TvTzOYvfA== Message-ID: Date: Thu, 22 Feb 2024 11:37:42 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Unlinking Parallel Hash Join inner batch files sooner Content-Language: en-US To: Thomas Munro Cc: Heikki Linnakangas , Jehan-Guillaume de Rorthais , John Naylor , pgsql-hackers References: <20230510230031.4d710fd1@karst> <871e80d4-e8cf-a117-ceb2-141586a3bcd2@iki.fi> From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 22/2/2024 06:42, Thomas Munro wrote: > On Wed, Feb 21, 2024 at 7:34 PM Andrei Lepikhov > wrote: >> I see in [1] that the reporter mentioned a delay between the error >> message in parallel HashJoin and the return control back from PSQL. Your >> patch might reduce this delay. >> Also, I have the same complaint from users who processed gigabytes of >> data in parallel HashJoin. Presumably, they also stuck into the unlink >> of tons of temporary files. So, are you going to do something with this >> code? > > Yeah, right. I will aim to get this into the tree next week. First, > there are a couple of minor issues to resolve around freeing that > Heikki mentioned. Then there is the question of whether we think this > might be a candidate for back-patching, given the complaints you > mention. Opinions? The code is related to performance, not a bug. Also, it adds one external function into the 'sharedtuplestore.h'. IMO, it isn't worth it to make back-patches. > > I would add that the problems you reach when you get to very large > number of partitions are hard (see several very long threads about > extreme skew for one version of the problem, but even with zero/normal > skewness and perfect estimation of the number of partitions, if you > ask a computer to partition 42TB of data into partitions that fit in a > work_mem suitable for a Commodore 64, it's gonna hurt on several > levels) and this would only slightly improve one symptom. One idea > that might improve just the directory entry and file descriptor > aspect, would be to scatter the partitions into (say) 1MB chunks > within the file, and hope that the file system supports holes (a bit > like logtape.c's multiplexing but I wouldn't do it quite like that). Thanks, I found in [1] good entry point to dive into this issue. [1] https://www.postgresql.org/message-id/CA+hUKGKDbv+5uiJZDdB1wttkMPFs9CDb6=02Qxitq4am-KBM_A@mail.gmail.com -- regards, Andrei Lepikhov Postgres Professional