Re: logical replication empty transactions

From: Euler Taveira <euler(at)timbira(dot)com(dot)br>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: logical replication empty transactions
Date: 2019-11-09 01:58:50
Message-ID: CAHE3wghivQ_27h3dktT2SA01nfSd8MPDpbqc7rbTGia=S_ppdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em seg., 21 de out. de 2019 às 21:20, Jeff Janes
<jeff(dot)janes(at)gmail(dot)com> escreveu:
>
> After setting up logical replication of a slowly changing table using the built in pub/sub facility, I noticed way more network traffic than made sense. Looking into I see that every transaction in that database on the master gets sent to the replica. 99.999+% of them are empty transactions ('B' message and 'C' message with nothing in between) because the transactions don't touch any tables in the publication, only non-replicated tables. Is doing it this way necessary for some reason? Couldn't we hold the transmission of 'B' until something else comes along, and then if that next thing is 'C' drop both of them?
>
That is not optimal. Those empty transactions is a waste of bandwidth.
We can suppress them if no changes will be sent. test_decoding
implements "skip empty transaction" as you described above and I did
something similar to it. Patch is attached.

--
Euler Taveira Timbira -
http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

Attachment Content-Type Size
0001-Skip-empty-transactions-for-logical-replication.patch text/x-patch 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-11-09 02:26:10 Re: pg_upgrade fails with non-standard ACL
Previous Message Michael Paquier 2019-11-09 01:56:18 Re: Monitoring disk space from within the server