Sync Rules
PowerSync Sync Rules allow developers to control which data gets synchronized to which devices (i.e. they enable dynamic partial replication).
Each PowerSync service instance has a sync rules configuration where sync rules are defined using SQL queries combined together in a YAML file.
The PowerSync service will use these SQL queries to group data into "sync buckets" when replicating data to client devices.

Sync rules are configured per PowerSync instance.
Functionality includes:
- Selecting tables and columns to sync.
- Filtering data according to user ID.
- Filter data with static conditions.
- Filter data with custom parameters.
- Transforming column values.
PowerSync replicates and transforms relevant data from the source database according to sync rules.
Data from this step is persisted in separate sync buckets on the PowerSync service. Data is incrementally updated so that sync buckets always contain current state data as well as a full history of changes.

Diagram showing how data is replicated from the source database into sync buckets.
PowerSync asynchronously hydrates local databases embedded in the PowerSync SDK based on data in sync buckets.

Data flow showing sync buckets which are created based on sync rules.
Last modified 13h ago