| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
To prepare your Postgres database for replication with Sequin, follow these steps:
Create a replication slot:
SELECT pg_create_logical_replication_slot('your_slot_name', 'pgoutput');Create a publication for the tables you want to replicate:
CREATE PUBLICATION your_publication_name FOR TABLE schema.table1, schema.table2 WITH (publish_via_partition_root = true);You can add more tables by separating them with commas. To publish all tables in a schema:
CREATE PUBLICATION your_publication_name FOR TABLES IN SCHEMA your_schema WITH (publish_via_partition_root = true);Set the replica identity for each table. There are two main options:
a. Default (only primary key is replicated for updates/deletes):
ALTER TABLE your_schema.your_table REPLICA IDENTITY DEFAULT;b. Full (entire old row is replicated for updates/deletes):
ALTER TABLE your_schema.your_table REPLICA IDENTITY FULL;The "full" option provides more detailed change information but may increase replication overhead.
Remember to adjust your Postgres configuration to allow replication connections. Also, ensure that the wal_level parameter in your PostgreSQL configuration is set to 'logical'. This setting enables logical decoding, which is necessary for logical replication.
| Back | FazBrowse Home | New Git URL |