Configuration options

Suggest edits

Some aspects of PGLogical can be configured using configuration options that can be either set in postgresql.conf or via ALTER SYSTEM SET.

  • pglogical.conflict_resolution Sets the resolution method for any detected conflicts between local data and incoming changes.

    Possible values:

    • error - the replication will stop on error if conflict is detected and manual action is needed for resolving
    • apply_remote - always apply the change that's conflicting with local data
    • keep_local - keep the local version of the data and ignore the conflicting change that is coming from the remote node
    • last_update_wins - the version of data with newest commit timestamp will be kept (this can be either local or remote version)
    • first_update_wins - the version of the data with oldest timestamp will be kept (this can be either local or remote version)

    The available settings and defaults depend on version of PostgreSQL and other settings.

    The default value in PostgreSQL is apply_remote.

    The keep_local, last_update_wins and first_update_wins settings require track_commit_timestamp PostgreSQL setting to be enabled. As track_commit_timestamp is not available in PostgreSQL 9.4 pglogical.conflict_resolution can only be apply_remote or error.

    In Postgres-XL, the only supported value and the default is error.

  • pglogical.conflict_log_level Sets the log level for reporting detected conflicts when the pglogical.conflict_resolution is set to anything else than error.

    Main use for this setting is to suppress logging of conflicts.

    Possible values are same as for log_min_messages PostgreSQL setting.

    The default is LOG.

  • pglogical.batch_inserts Tells PGLogical to use batch insert mechanism if possible. Batch mechanism uses PostgreSQL internal batch insert mode which is also used by COPY command.

    The batch inserts will improve replication performance of transactions that did many inserts into one table. PGLogical will switch to batch mode when transaction did more than 5 INSERTs.

    It's only possible to switch to batch mode when there are no INSTEAD OF INSERT and BEFORE INSERT triggers on the table and when there are no defaults with volatile expressions for columns of the table. Also the batch mode will only work when pglogical.conflict_resolution is set to error.

    The default is true.

  • pglogical.use_spi Tells PGLogical to use SPI interface to form actual SQL (INSERT, UPDATE, DELETE) statements to apply incoming changes instead of using internal low level interface.

    This is mainly useful for Postgres-XL and debugging purposes.

    The default in PostgreSQL is false.

    This can be set to true only when pglogical.conflict_resolution is set to error. In this state, conflicts are not detected.

    In Postgres-XL the default and only allowed setting is true.

  • pglogical.temp_directory Defines system path where to put temporary files needed for schema synchronization. This path need to exist and be writable by user running Postgres.

    Default is empty, which tells PGLogical to use default temporary directory based on environment and operating system settings.


Could this page be better? Report a problem or suggest an addition!