Re: pg_dump versus hash partitioning
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>,
Alvaro Herrera <alvherre@alvh.no-ip.org>,
David Rowley <dgrowleyml@gmail.com>, Peter Geoghegan <pg@bowt.ie>,
pgsql-hackers@lists.postgresql.org,
Andrew <pgsqlhackers@andrewrepp.com>
Date: 2023-02-27T16:20:34Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > On Tue, Feb 14, 2023 at 2:21 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> This made me wonder if this could be a usable solution at all, but >> after thinking for awhile, I don't see how the claim about foreign key >> constraints is anything but FUD. pg_dump/pg_restore have sufficient >> dependency logic to prevent that from happening. I think we can just >> drop the "or perhaps ..." clause here, and tolerate the possible >> inefficiency as better than failing. > Right, but isn't that dependency logic based around the fact that the > inserts are targeting the original partition? Like, suppose partition > A has a foreign key that is not present on partition B. A row that is > originally in partition B gets rerouted into partition A. It must now > satisfy the foreign key constraint when, previously, that was > unnecessary. Well, that's a user error not pg_dump's fault. Particularly so for hash partitioning, where there is no defensible reason to make the partitions semantically different. There could be a risk of a timing problem, namely that parallel pg_restore tries to check an FK constraint before all the relevant data has arrived. But in practice I don't believe that either. We load all the data in "data" phase and then create indexes and check FKs in "post-data" phase, and I do not believe that parallel restore weakens that separation (because it's enforced by a post-data boundary object in the dependencies). regards, tom lane
Commits
-
Simplify and speed up pg_dump's creation of parent-table links.
- 064709f803c0 16.0 landed
-
Fix pg_dump for hash partitioning on enum columns.
- bc8cd50fefd3 16.0 landed
- 8f83ce8c5244 12.15 landed
- 7e7c5b683985 13.11 landed
- 5fc1ac151d85 14.8 landed
- 2b216da1e55d 15.3 landed
- 012ffb365a05 11.20 landed