Postgresql 中文操作指南

Chapter 49. Logical Decoding

Table of Contents

PostgreSQL 为基础架构提供通过 SQL 执行的修改流传输到外部消费者的功能。此功能可用于不同的用途,包括复制解决方案和审核。

PostgreSQL provides infrastructure to stream the modifications performed via SQL to external consumers. This functionality can be used for a variety of purposes, including replication solutions and auditing.

变更通过逻辑复制槽所标识的流发送。

Changes are sent out in streams identified by logical replication slots.

流传输变更的格式由所用的输出插件决定。PostgreSQL 发行版中提供一个示例插件。可以编写其他插件以扩展可用格式选择,而无需修改任何核心代码。每个输出插件都可以访问 INSERT 产生的每个新行和 UPDATE 创建的新行版本。 UPDATEDELETE 的旧行版本的可用性取决于配置的副本标识(参见 REPLICA IDENTITY )。

The format in which those changes are streamed is determined by the output plugin used. An example plugin is provided in the PostgreSQL distribution. Additional plugins can be written to extend the choice of available formats without modifying any core code. Every output plugin has access to each individual new row produced by INSERT and the new row version created by UPDATE. Availability of old row versions for UPDATE and DELETE depends on the configured replica identity (see REPLICA IDENTITY).

可以使用流复制协议(参见 Section 55.4Section 49.3 )或通过 SQL 调用函数(参见 Section 49.4 )来使用变更。还可以编写其他方法来使用复制槽的输出,而无需修改核心代码(参见 Section 49.7 )。

Changes can be consumed either using the streaming replication protocol (see Section 55.4 and Section 49.3), or by calling functions via SQL (see Section 49.4). It is also possible to write additional methods of consuming the output of a replication slot without modifying core code (see Section 49.7).