How Can I Ensure Data Integrity When Upgrading or Migrating My PostgreSQL Database?
Question
I plan to upgrade my PostgreSQL database to a more recent version, or migrate it. What steps should I take to ensure data integrity?
Environment
- Connector: PostgreSQL
- Incremental sync method: Logical Replication
Answer
Upgrading or migrating your PostgreSQL database destroys the database replication slot. To avoid data integrity issues, do the following:
In Fivetran, pause the connection:
i. Go to your PostgreSQL connection page.
ii. In the top right, set the Enabled toggle to OFF.
In PostgreSQL, drop the replication slot.
Complete the upgrade or migration.
Re-create the replication slot.
In Fivetran, test the connection to verify the configuration:
i. On the PostgreSQL connection page, select the Settings tab.
ii. Click Edit connection.
iii. Click Save & Test.
Re-sync the connection. For instructions, see How to Trigger Historical Re-Syncs.
Resume the connection by setting the Enabled toggle to ON.