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 1pNJor-0000Yx-HW for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 20:35:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNJop-00029z-78 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 20:34:59 +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 1pNJoo-00029N-U5 for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 20:34:58 +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 1pNJom-0006lr-Er for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 20:34:57 +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 311KYq3N1412539; Wed, 1 Feb 2023 15:34:52 -0500 From: Tom Lane To: Robert Haas cc: pgsql-hackers@lists.postgresql.org, Andrew Subject: Re: pg_dump versus hash partitioning In-reply-to: References: <1376149.1675268279@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 01 Feb 2023 12:39:32 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1412537.1675283692.1@sss.pgh.pa.us> Date: Wed, 01 Feb 2023 15:34:52 -0500 Message-ID: <1412538.1675283692@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > ... I like the > fact that we have --load-via-partition-root, but it is a bit of a > hack. You don't get a single copy into the partition root, you get one > per child table -- and those COPY statements are listed as data for > the partitions where the data lives now, not for the parent table. I > am not completely sure whether there is a scenario where that's an > issue, but it's certainly an oddity. I spent a bit more time thinking about that, and while I agree that it's an oddity, I don't see that it matters in the case of hash partitioning. You would notice an issue if you tried to do a selective restore of just one partition --- but under what circumstance would that be a useful thing to do? By definition, under hash partitioning there is no user-meaningful difference between different partitions. Moreover, in the case at hand you would get constraint failures without --load-via-partition-root, or tuple routing failures with it, so what's the difference? (Unless you'd created all the partitions to start with and were doing a selective restore of just one partition's data, in which case the outcome is "fails" or "works" respectively.) > Also, and I think pretty > significantly, using --load-via-partition-root forces you to pay the > overhead of rerouting every tuple to the target partition whether you > need it or not, which is potentially a large unnecessary expense. Oddly, I always thought that we prioritize correctness over speed. I don't mind having an option that allows people to select a less-safe way of doing this, but I do think it's unwise for less-safe to be the default, especially when it's something you can't fix after the fact. What do you think of "--load-via-partition-root=on/off/auto", where auto means "not with hash partitions" or the like? I'm still uncomfortable about the collation aspect, but I'm willing to concede that range partitioning is less likely to fail in this way than hash. regards, tom lane