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 1papcn-0005H9-LJ for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Mar 2023 03:10:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1papcm-0005vi-He for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Mar 2023 03:10:24 +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 1papcm-0005vN-8g for pgsql-hackers@lists.postgresql.org; Sat, 11 Mar 2023 03:10:24 +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 1papcj-0000P3-LU for pgsql-hackers@lists.postgresql.org; Sat, 11 Mar 2023 03:10:23 +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 32B3AERW1078805; Fri, 10 Mar 2023 22:10:14 -0500 From: Tom Lane To: Julien Rouhaud cc: Andrew Dunstan , Alvaro Herrera , David Rowley , Peter Geoghegan , Robert Haas , pgsql-hackers@lists.postgresql.org, Andrew Subject: Re: pg_dump versus hash partitioning In-reply-to: <20230311030154.pg63uspio35h4a6t@jrouhaud> References: <1425446.1675291093@sss.pgh.pa.us> <1440373.1675299790@sss.pgh.pa.us> <1533086.1675349554@sss.pgh.pa.us> <1912821.1676402493@sss.pgh.pa.us> <20230311030154.pg63uspio35h4a6t@jrouhaud> Comments: In-reply-to Julien Rouhaud message dated "Sat, 11 Mar 2023 11:01:54 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1078803.1678504214.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 10 Mar 2023 22:10:14 -0500 Message-ID: <1078804.1678504214@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Julien Rouhaud writes: > Working on some side project that can cause dump of hash partitions to b= e > routed to a different partition, I realized that --load-via-partition-ro= ot can > indeed cause deadlock in such case without FK dependency or anything els= e. > The problem is that each worker will perform a TRUNCATE TABLE ONLY follo= wed by > a copy of the original partition's data in a transaction, and that obvio= usly > will lead to deadlock if the original and locked partition and the resto= red > partition are different. Oh, interesting. I wonder if we can rearrange things to avoid that. regards, tom lane