作者
digoal
日期
2022-03-31
标签
PostgreSQL , logical replication , 空事务
当事务中没有包含发布端的数据、或者包含的数据全部都被定义的过滤器过滤掉了, 这个事务的信息不应该发送给订阅端, 否则是浪费网络带宽和CPU.
PostgreSQL 15 支持跳过此类的“空事务” , 并且在synchronous 复制模式下, 使用定时的心跳包代替空事务.
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=d5a9d86d8ffcadc52ff3729cd00fbd83bc38643c
Skip empty transactions for logical replication.
author Amit Kapila <akapila@postgresql.org>
Wed, 30 Mar 2022 02:11:05 +0000 (07:41 +0530)
committer Amit Kapila <akapila@postgresql.org>
Wed, 30 Mar 2022 02:11:05 +0000 (07:41 +0530)
commit d5a9d86d8ffcadc52ff3729cd00fbd83bc38643c
tree 2b5497206cf558509284df8817bd350e4d27dbb1 tree
parent ad4f2c47de440cdd5d58cf9ffea09afa0da04d6c commit | diff
Skip empty transactions for logical replication.
The current logical replication behavior is to send every transaction to
subscriber even if the transaction is empty. This can happen because
transaction doesn't contain changes from the selected publications or all
the changes got filtered. It is a waste of CPU cycles and network
bandwidth to build/transmit these empty transactions.
This patch addresses the above problem by postponing the BEGIN message
until the first change is sent. While processing a COMMIT message, if
there was no other change for that transaction, do not send the COMMIT
message. This allows us to skip sending BEGIN/COMMIT messages for empty
transactions.
When skipping empty transactions in synchronous replication mode, we send
a keepalive message to avoid delaying such transactions.
Author: Ajin Cherian, Hou Zhijie, Euler Taveira
Reviewed-by: Peter Smith, Takamichi Osumi, Shi Yu, Masahiko Sawada, Greg Nancarrow, Vignesh C, Amit Kapila
Discussion: https://postgr.es/m/CAMkU=1yohp9-dv48FLoSPrMqYEyyS5ZWkaZGD41RJr10xiNo_Q@mail.gmail.com
期望 PostgreSQL 增加什么功能?
PolarDB for PostgreSQL云原生分布式开源数据库
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




