CREATE_REPLICATION_SLOT

Synopsis

Use the CREATE_REPLICATION_SLOT statement to create a replication slot.

Syntax

create_replication_slot ::= CREATE_REPLICATION_SLOT slot_name LOGICAL 
                            output_plugin 
                            [ NOEXPORT_SNAPSHOT | USE_SNAPSHOT ]

create_replication_slot

CREATE_REPLICATION_SLOTslot_nameLOGICALoutput_pluginNOEXPORT_SNAPSHOTUSE_SNAPSHOT

Semantics

slot_name

The name of the replication slot. The name of the replication slot must be unique across all databases.

output_plugin

The name of the output plugin used for logical decoding.

NOEXPORT_SNAPSHOT / USE_SNAPSHOT

Decides what to do with the snapshot created during logical slot initialization.

USE_SNAPSHOT indicates the intention of the client to consume the snapshot. This option must be used in a transaction, and CREATE_REPLICATION_SLOT must be the first command run in that transaction.

NOEXPORT_SNAPSHOT will just use the snapshot for logical decoding as normal but won't do anything else with it.

Examples

Create a Replication Slot with name test_replication_slot and use the yboutput plugin.

yugabyte=# CREATE_REPLICATION_SLOT test_replication_slot LOGICAL yboutput;

Create a Replication Slot with name test_replication_slot and use the pgoutput plugin.

yugabyte=# CREATE_REPLICATION_SLOT test_replication_slot LOGICAL pgoutput;

See also