Skip to content

Commit b1356f1

Browse files
committed
Doc: warn against using parallel restore with --load-via-partition-root.
This isn't terribly safe, and making it so doesn't seem like a small project, so for the moment just warn against it. Discussion: https://postgr.es/m/13624.1535486019@sss.pgh.pa.us
1 parent fe30cd2 commit b1356f1

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -793,13 +793,26 @@ PostgreSQL documentation
793793
<term><option>--load-via-partition-root</option></term>
794794
<listitem>
795795
<para>
796-
When dumping a <command>COPY</command> or <command>INSERT</command> statement for a partitioned table,
797-
target the root of the partitioning hierarchy which contains it rather
798-
than the partition itself. This may be useful when reloading data on
799-
a server where rows do not always fall into the same partitions as
800-
they did on the original server. This could happen, for example, if
801-
the partitioning column is of type text and the two system have
802-
different definitions of the collation used to partition the data.
796+
When dumping data for a table partition, make
797+
the <command>COPY</command> or <command>INSERT</command> statements
798+
target the root of the partitioning hierarchy that contains it, rather
799+
than the partition itself. This causes the appropriate partition to
800+
be re-determined for each row when the data is loaded. This may be
801+
useful when reloading data on a server where rows do not always fall
802+
into the same partitions as they did on the original server. That
803+
could happen, for example, if the partitioning column is of type text
804+
and the two systems have different definitions of the collation used
805+
to sort the partitioning column.
806+
</para>
807+
808+
<para>
809+
It is best not to use parallelism when restoring from an archive made
810+
with this option, because <application>pg_restore</application> will
811+
not know exactly which partition(s) a given archive data item will
812+
load data into. This could result in inefficiency due to lock
813+
conflicts between parallel jobs, or perhaps even reload failures due
814+
to foreign key constraints being set up before all the relevant data
815+
is loaded.
803816
</para>
804817
</listitem>
805818
</varlistentry>

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,21 @@ PostgreSQL documentation
330330
<term><option>--load-via-partition-root</option></term>
331331
<listitem>
332332
<para>
333-
When dumping a <command>COPY</command> or <command>INSERT</command> statement for a partitioned table,
334-
target the root of the partitioning hierarchy which contains it rather
335-
than the partition itself. This may be useful when reloading data on
336-
a server where rows do not always fall into the same partitions as
337-
they did on the original server. This could happen, for example, if
338-
the partitioning column is of type text and the two system have
339-
different definitions of the collation used to partition the data.
340-
</para>
333+
When dumping data for a table partition, make
334+
the <command>COPY</command> or <command>INSERT</command> statements
335+
target the root of the partitioning hierarchy that contains it, rather
336+
than the partition itself. This causes the appropriate partition to
337+
be re-determined for each row when the data is loaded. This may be
338+
useful when reloading data on a server where rows do not always fall
339+
into the same partitions as they did on the original server. That
340+
could happen, for example, if the partitioning column is of type text
341+
and the two systems have different definitions of the collation used
342+
to sort the partitioning column.
343+
</para>
344+
345+
<!-- Currently, we don't need pg_dump's warning about parallelism here,
346+
since parallel restore from a pg_dumpall script is impossible.
347+
-->
341348
</listitem>
342349
</varlistentry>
343350

0 commit comments

Comments
 (0)