Search code examples
postgresqlgoogle-cloud-platformapache-kafkaapache-kafka-connectdebezium

Difference between decoderbufs and pgoutput in using as plug-in for logical decoding in Postgres


I am trying to understand the difference between using decoderbufs vs pgouput when deciding the plugin to use for logical decoding in Postgres using Dbezium.

I can choose either but what are the pros and cons of using each ?

More importantly, it's not quite clear to me how decoderbufs act behind the scene.

An example: pgoutput needs publications, which helps to limit what the replication_slots will hold information for so i can use that for the slot to look only at specific table (IMO). But on the other hand, its not clear to me how decoderbufs works.

Any insight would be super useful :pray:

Tried to search but could not find much information.


Solution

  • pgoutput is the default logical decoding output plugin used by Postgres. And it decodes the WAL file entries and sends the change data capture events to the consumer. And it sends the events in binary format. The message format is documented here

    decoderbufs is another logical decoding plugin used to deliver change data capture events as Protocol Buffers. It's not part of Postgres core. You would need to build and install the extension. Refer https://github.com/xstevens/decoderbufs

    After installing the plugin, you would need to update the Postgres config to load the shared library. This github project is not actively maintained. So it would be better to use the fork of this project which is actively maintained by Debezium team. Refer https://github.com/debezium/postgres-decoderbufs

    And decoderbufs is not supported by major cloud vendors like AWS, Azure, Google Cloud. Hence decoderbufs is recommended for on-premise use. Whereas pgouput is supported by the Postgres server offered by all major cloud vendors.