From 9de77b5453130242654ff0b30a551c9c862ed661 Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Sat, 18 Jul 2020 12:44:51 -0400
Subject: Allow logical replication to transfer data in binary format.
This patch adds a "binary" option to CREATE/ALTER SUBSCRIPTION.
When that's set, the publisher will send data using the data type's
typsend function if any, rather than typoutput. This is generally
faster, if slightly less robust.
As committed, we won't try to transfer user-defined array or composite
types in binary, for fear that type OIDs won't match at the subscriber.
This might be changed later, but it seems like fit material for a
follow-on patch.
Dave Cramer, reviewed by Daniel Gustafsson, Petr Jelinek, and others;
adjusted some by me
Discussion: https://postgr.es/m/CADK3HH+R3xMn=8t3Ct+uD+qJ1KD=Hbif5NFMJ+d5DkoCzp6Vgw@mail.gmail.com
---
doc/src/sgml/catalogs.sgml | 26 ++++++++++++++++++--------
doc/src/sgml/ref/alter_subscription.sgml | 6 ++++--
doc/src/sgml/ref/create_subscription.sgml | 26 ++++++++++++++++++++++++--
3 files changed, 46 insertions(+), 12 deletions(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index e9cdff48641..18ab3d434cb 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7472,7 +7472,7 @@ SCRAM-SHA-256$<iteration count>:&l
(references pg_database.oid)
- OID of the database which the subscription resides in
+ OID of the database that the subscription resides in
@@ -7500,7 +7500,17 @@ SCRAM-SHA-256$<iteration count>:&l
subenabledbool
- If true, the subscription is enabled and should be replicating.
+ If true, the subscription is enabled and should be replicating
+
+
+
+
+
+ subbinarybool
+
+
+ If true, the subscription will request that the publisher send data
+ in binary format
@@ -7518,8 +7528,8 @@ SCRAM-SHA-256$<iteration count>:&l
subslotnamename
- Name of the replication slot in the upstream database. Also used
- for local replication origin name.
+ Name of the replication slot in the upstream database (also used
+ for the local replication origin name)
@@ -7528,8 +7538,8 @@ SCRAM-SHA-256$<iteration count>:&l
subsynccommittext
- Contains the value of the synchronous_commit
- setting for the subscription workers.
+ The synchronous_commit
+ setting for the subscription's workers to use
@@ -7538,8 +7548,8 @@ SCRAM-SHA-256$<iteration count>:&l
subpublicationstext[]
- Array of subscribed publication names. These reference the
- publications on the publisher server. For more on publications
+ Array of subscribed publication names. These reference
+ publications defined in the upstream database. For more on publications
see .
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index c24ace14d10..81c4e70cdf4 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -163,8 +163,10 @@ ALTER SUBSCRIPTION name RENAME TO <
This clause alters parameters originally set by
. See there for more
- information. The allowed options are slot_name and
- synchronous_commit
+ information. The parameters that can be altered
+ are slot_name,
+ synchronous_commit, and
+ binary.
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 5bbc165f70d..cdb22c54fea 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -152,8 +152,9 @@ CREATE SUBSCRIPTION subscription_name
The value of this parameter overrides the
- setting. The default
- value is off.
+ setting within this
+ subscription's apply worker processes. The default value
+ is off.
@@ -178,6 +179,27 @@ CREATE SUBSCRIPTION subscription_name
+
+ binary (boolean)
+
+
+ Specifies whether the subscription will request the publisher to
+ send the data in binary format (as opposed to text).
+ The default is false.
+ Even when this option is enabled, only data types that have
+ binary send and receive functions will be transferred in binary.
+
+
+
+ When doing cross-version replication, it could happen that the
+ publisher has a binary send function for some data type, but the
+ subscriber lacks a binary receive function for the type. In
+ such a case, data transfer will fail, and
+ the binary option cannot be used.
+
+
+
+
connect (boolean)
--
cgit v1.2.3