| title | Restoring your source database |
|---|---|
| description | How PowerSync handles source database restores and what to expect during reprocessing |
Backing up your source database does not affect PowerSync operation. However, restoring from a backup typically requires PowerSync to perform a full reprocess of the data.
This page explains what happens when you restore your source database and how to plan for it.
When you restore your source database from a backup:
- PowerSync's replication state may become invalid
- The PowerSync Service will need to reprocess data from the restored database
- The reprocessing might not happen automatically, and you may need to trigger it manually (by redeploying the sync rules or restarting the service).
- Clients can continue syncing existing data during reprocessing, but new changes won't sync until it's complete. They may experience temporary delays.
When planning source database backup and recovery:
- Test restore procedures in a staging environment to understand reprocessing duration
- Plan maintenance windows during low-traffic periods for database restores
- Consider data volume when estimating recovery time - larger datasets take longer to reprocess
- Data volume: Total size of data in synced tables
- Sync rules complexity: Number of tables, joins, and transformations
- Database performance: CPU, memory, and I/O capacity
For more details on performance considerations, see Performance and Limits.
For multi-tenant architectures using a shared database with tenant isolation through sync rules, you can perform tenant-specific recovery without triggering a full reprocess.
Instead of restoring the entire database, restore only the affected tenant's data:
- Backup and restore tenant-specific data using your source database's native tools with filtering (e.g.,
WHERE tenant_id = X) - PowerSync detects restored data as incremental changes and replicates them automatically
- Other tenants continue operating without interruption (assuming replication keeps pace)
Large tenant restores increase replication volume. Monitor:
- Replication lag during restore operations using Monitoring and Alerting
- Data volume impact - high volumes can affect all tenants if replication falls behind
Different source databases use different replication mechanisms:
- Postgres: Logical replication slots (see Postgres Maintenance for slot management)
- MongoDB: Change stream resume tokens
- MySQL: Binary log positions (GTID)
- MSSQL: Change Data Capture (CDC)
The specific behavior after a restore may vary by database type. PowerSync uses checkpoints to maintain consistency during the recovery process.