- DATE:
- AUTHOR:
- PowerSync Product Team
Introducing: Raw SQLite Tables Support (Experimental)
Current JSON-based SQLite Views System
By default, PowerSync uses a JSON-based view system to store data schemalessly in JSON format and then presented through SQLite views based on the client-side schema. This system is great for most scenarios and saves you from running client-side migrations. Still, it has a few limitations: extracting data from JSON adds overhead, advanced SQLite features (like foreign keys or custom indexes) aren’t available, and complex queries can run slowly.
Introducing Raw Tables
Raw tables bypass these limitations by allowing you to define native SQLite tables. Consider using raw tables when you need:
Advanced SQLite features (
FOREIGN KEY
,ON DELETE CASCADE
)Custom indexes (e.g., indexing on expressions,
GENERATED
columns)Improved query performance for complex queries (e.g. aggregations)
Reduced JSON storage overhead
Manual control over table creation (e.g. custom triggers)
How It Works (High-Level)
When opting into raw tables:
Create SQLite tables manually (PowerSync does not auto-create them).
Define SQL statements (upserts and deletions) that map JSON-based synced data into your tables.
Configure triggers to forward local mutations back to PowerSync.
Full implementation instructions and examples are available in the documentation.
Availability
Raw tables support is available starting with the following SDK versions:
JavaScript (Web:
1.24.0
, React Native:1.23.0
, Node.js:0.8.0
)Dart: Version
1.15.0
ofpackage:powersync
.Kotlin: Version
1.3.0
Swift: Version
1.3.0
Note: Raw tables are also only supported by our new Rust-based sync client, currently available as an opt-in feature.
Experimental Feature – We Need Your Feedback
Raw tables are currently experimental. We're actively seeking feedback, especially on:
The API design and developer experience
Additional features or optimizations needed
Please share your feedback on Discord.