Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Great post, I really like the approach of adding additional context for WAL CDC.
I use both the trigger + audit table in my sass (for user-facing activity feeds) and subscribe to CDC WAL changes for dealing with callback -like logic (i.e., send registration email, clear cache).
I'm not a fan of pg_notify due to requirement of adding triggers (performance penalty) and the 8k character limit per column (you will lose data is it will splice off anything larger than that).
Application-level tracking or callbacks makes the stack dependent on the application for data integrity, I'd rather the database be the source of truth on all things data.
I'm the maintainer of an open-source CDC library for PostgreSQL called WalEx. It's lighter weight and much simpler to operate than Debezium:
https://github.com/cpursley/walex
For something turn-key, Bemi looks like a really good option!
It depends on your reliability and performance constraints. I'd recommend just doing this via hooks on the application layer if it's a simple application. If you're building a production scalable application that required reliability guarantees - you can do this with https://github.com/BemiHQ/bemi too (I'm one of the maintainers from the article). I saw you mentioned you're using Node.js, check out the Bemi github there's a few Node.js compatible libraries too. Feel free to ping me any q's!
I feel like i keep yelling the following, but bitemporal tables.
- https://aiven.io/blog/two-dimensional-time-with-bitemporal-d...
- https://github.com/scalegenius/pg_bitemporal
4 timestamps and some ugly queries.