What is the best way to read from PgQ to Apache Kafka?

311 views Asked by At

I want to capture data changes from few tables in a huge PostgreSQL database. Initially I planned to use the logical decoding feature with Debezium. But this solution has significant overhead since it's necessary to decode the entire WAL. Another solution uses triggers and PgQ. Is there any general way to integrate PgQ with Kafka or perhaps a Kafka connector for this purpose?

1

There are 1 answers

4
Robin Moffatt On

You either go transaction log, or you go query-based.

Which you use depends on your use of the data. Query-based polls the DB, log-based uses the log (WAL).

I'm interested in your assertion that Debezium has "significant overhead"—have you quantified this? I know there are lots of people using it and it's not usually raised as an issue.

For query-based capture use the Kafka Connect JDBC source connector.

You can see pros and cons of each approach here: http://rmoff.dev/ksny19-no-more-silos