Skip to content

PostgreSQL

TwinCommit captures changes from PostgreSQL with a logical replication slot and the built-in pgoutput plugin, so there are no extensions to install. It manages its own publication and slot and streams committed transactions in commit order.

Supported: PostgreSQL 13–18, Amazon RDS and Aurora PostgreSQL, Azure Database for PostgreSQL Flexible Server, Google Cloud SQL.

# postgresql.conf
wal_level = logical
max_replication_slots = 10
max_wal_senders = 10

On managed services, set rds.logical_replication = 1 (AWS) or azure.replication_support = logical (Azure), or enable the cloudsql.logical_decoding flag (GCP).

CREATE ROLE twincommit WITH LOGIN REPLICATION PASSWORD '********';
GRANT SELECT ON ALL TABLES IN SCHEMA public TO twincommit;
GRANT CREATE ON DATABASE app TO twincommit; -- to create the publication

Tables need a primary key, or REPLICA IDENTITY FULL:

ALTER TABLE public.events REPLICA IDENTITY FULL;
source:
type: postgres
dsn: postgres://twincommit:${PG_SRC_PASSWORD}@pg-primary:5432/app
slot: twincommit_app
publication: twincommit_app