logical replication empty transactions - Mailing list pgsql-hackers

From Jeff Janes
Subject logical replication empty transactions
Date
Msg-id CAMkU=1yohp9-dv48FLoSPrMqYEyyS5ZWkaZGD41RJr10xiNo_Q@mail.gmail.com
Whole thread Raw
Responses Re: logical replication empty transactions  (Euler Taveira <euler@timbira.com.br>)
List pgsql-hackers
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?

There is a comment for WalSndPrepareWrite which seems to foreshadow such a thing, but I don't really see how to use it in this case.  I want to drop two messages, not one.
 
 * Don't do anything lasting in here, it's quite possible that nothing will be done
 * with the data.

This applies to all version which have support for pub/sub, including the recent commits to 13dev.

I've searched through the voluminous mailing list threads for when this feature was being presented to see if it was already discussed, but since every word I can think to search on occurs in virtually every message in the threads in some context or another, I didn't have much luck.

Cheers,

Jeff

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays
Next
From: Andrew Alsup
Date:
Subject: Re: Re: SQL/JSON: functions