Updated on 2025-05-29 GMT+08:00

Logical Replication

max_changes_in_memory

Parameter description: Specifies the maximum number of DML statements cached in memory for a single transaction during logical decoding.

Parameter type: integer.

Unit: none

Value range: 1 to 2147483647

Default value: 4096

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is too large, a large amount of dynamic memory is occupied when large transactions are decoded. If the value is too small, the decoding efficiency decreases.

max_cached_tuplebufs

Parameter description: Specifies the upper limit of the total tuple information cached in the memory during logical decoding.

Parameter type: integer.

Unit: none

Value range: 1 to 2147483647

Default value: 8192

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value. You are advised to set this parameter to a value greater than or equal to twice of max_changes_in_memory.

Risks and impacts of improper settings: If the value is too large, a large amount of dynamic memory is occupied when large transactions are decoded. If the value is too small, the decoding efficiency decreases.

logical_decode_options_default

Parameter description: Specifies the global default parameters when a logical decoding task is started.

Parameter type: string.

Unit: none

Value range: a string of key=value characters separated by commas (,), for example, "parallel-decode-num=4,parallel-queue-size=128,exclude-users=userA,skip-generated-columns=on". An empty string indicates that the default value hardcoded by the program is used.

Default value: ""

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Currently, the following logical decoding options are supported: parallel-decode-num, parallel-queue-size, max-txn-in-memory, max-reorderbuffer-in-memory, exclude-users, skip-generated-columns, decode-sequence, and data-limit. For details about the options, see "Logical Replication > Logical Decoding > Logical Decoding Options" in Feature Guide.

  • The SIGHUP parameter does not affect the started logical decoding process. The options specified by logical_decode_options_default are used as the default settings for subsequent logical decoding startup, and the settings specified in the startup command are used.

  • The exclude-users option specified by logical_decode_options_default is different from the logical decoding startup option exclude-users. You are not allowed to specify multiple blacklisted users.
  • decode-sequence configured in logical_decode_options_default can only be set to false.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

logical_sender_timeout

Parameter description: Specifies the maximum waiting time for the sender to wait for the receiver to receive logical logs.

Parameter type: integer.

Unit: ms

Value range: 0 to 2147483647

Default value: 30000 (30s)

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

enable_logicalrepl_xlog_prune

Parameter description: Specifies whether to enable the function of forcibly invalidating a logical replication slot. When enable_logicalrepl_xlog_prune is set to on, max_size_for_xlog_retention is greater than 0, and the number of retained log segments (16 MB for each log segment) exceeds the value of max_size_for_xlog_retention due to the current logical replication slot, or max_size_for_xlog_retention is less than 0 and the disk usage reaches (–max_size_for_xlog_retention)/100, the logical replication slot will be forcibly invalidated, restart_lsn is set to 7FFFFFFF/FFFFFFFF, and the replication slot does not block the recycling of Xlogs.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The function of forcibly invalidating a logical replication slot is enabled.
  • off: The function of forcibly invalidating a logical replication slot is disabled.

Default value: off

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Determine whether to enable this function based on service requirements.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

enable_logical_replication_ddl

Parameter description: Specifies whether the logical decoding supports DDL statements, reverse parsing, and log generation.

Parameter type: Boolean.

Unit: none

Value range:

  • on: Logical replication supports DDL statements, reversely parses DDL execution results, and generates DDL WALs.
  • off: DDL statements are not supported, reverse parsing is not performed, and WALs are not generated.

Default value: on

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

enable_logical_replication_dictionary

Parameter description: Specifies whether to enable the function of creating logical replication slots for multi-version dictionary tables.

Parameter type: Boolean.

Unit: none

Value range:

  • on: enabled.
  • off: disabled.

Default value: on

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value on. If you need to create a logical replication slot of the online catalog type, set this parameter to off.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

If this parameter is enabled, a logical replication slot can be created only after the system catalog of the dictionary type is baselined. Otherwise, the creation fails.

max_keep_log_seg

Parameter description: Flow control parameter. In logical replication, physical logs are parsed and converted into logical logs locally on the DN. When the number of physical log files that are not parsed is greater than the value of this parameter, flow control is triggered.

Parameter type: integer.

Unit: none

Value range: 0 to 2147483647. 0 indicates that the flow control function is disabled.

Default value: 0

Setting method: This is a USERSET parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Determine whether to perform flow control based on service requirements.

Risks and impacts of improper settings: If the value is too large, flow control will not be triggered.

logical_replication_dictionary_retention_time

Parameter description: Specifies the retention period of data in the system catalogs related to GS_TXN_LSN_TIME and the data dictionary.

Parameter type: integer

Unit: day

Value range: 1 to 3650

Default value: 365

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Set this parameter based on service requirements.

Risks and impacts of improper settings: If the value is too small, the available interval for decoding the positioning point is too small. If the value is too large, the decoding performance is affected.

logical_replica_identity_force

Parameter description: Specifies the record level of old tuples for global logical replication.

Parameter type: enumerated type

Unit: none

Value range:

  • 'full': All columns are recorded as replica identifiers.
  • 'unique': The replica identifier is the primary key and unique key.
  • 'default': The replica identifier is selected by default (primary key or none).
  • 'nothing': There is no replica identifier for recording this relationship.
  • 'none'‬: The global control parameter does not take effect.

Default value: 'none'‬

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

To reset logical_replica_identity_force that has been set to a non-default value to 'none'‬, you need to restore the GUC parameter to the default value.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.