Synchronization Replication with the Log-Based Method v6.2

In PostgreSQL 9.4 a feature has been introduced called logical decoding (also called logical replication or changeset extraction). This feature provides the capability to extract data manipulation language (DML) changes from the Write-Ahead Log segments (WAL files) in a readable format.

For information on logical decoding see the PostgreSQL Core Documentation located at:

https://www.postgresql.org/docs/current/static/logicaldecoding.html

The key significance of this feature is the ability to capture data changes to the publication tables without impacting the online transaction processing rate against these tables that occurs when using the trigger-based method. The trigger-based method results in the firing of row-level triggers whenever data changes occur, then inserting these data changes into shadow tables for temporary storage before applying the changes to the target databases.

Thus, extracting data changes using logical decoding can be beneficial for improving database server throughput and replication latency.

However, note that the logical decoding interface streams changes for all tables in a given database, which may have a performance overhead associated with it. For example, if a database contains 100 tables, and the user is interested in replicating only a small subset of these tables, say only 20 tables in a single publication, the logical decoding protocol will stream changes for all 100 tables to the publication server. The publication server eventually filters out the changes for the irrelevant 80 tables. However, this results in network overhead caused by the additional changeset load that is not required by the replication system.

Using logical decoding to extract changes from a publication database during xDB synchronization replication is referred to as the log-based method.

The following sections describe the basic requirements and concepts for the log-based method of synchronization replication.

requirements_and_restrictions logical_replication_slots streaming_replication_wal_sender replication_origin inmemory_caching