Concepts
Change data capture
Change data capture (CDC) refers to the process of identifying and capturing changes made to data in a database and then delivering those changes in real-time to a downstream process or system.
Logical replication
Logical replication is a method of replicating data objects and their changes based on their replication identity (usually a primary key). You can read more about logical replication and how it pertains to your database in Postgres' documentation here.
-
Create a logical replication slot:
SELECT pg_create_logical_replication_slot('$REPLICATION_SLOT_NAME', 'pgoutput');
Learn more here.
-
View your logical replication slots:
SELECT slot_name, slot_type FROM pg_replication_slots WHERE slot_type = 'logical';
Write-ahead log
A write-ahead log (WAL) is a standard way of ensuring data integrity by only allowing updates to the data in a database after a log has been written to permanent storage describing the change to take place.
This enhances data integrity because all changes to a database are recorded in these log files. In the event of a database crash, the database is recoverable using those logs and can even be recovered to a specific point in time.