- For all native targets, write-ahead logging (WAL) is enabled to support concurrent reads and writes. PowerSync also dispatches queries to multiple threads for parallelism. With the JavaScript web SDK, a WAL-like option is available on Chromium browsers.
- SDKs also configure connections for performance by enabling a large page cache of around 50MB and setting
pragma synchronous = normalto avoid frequent fsync operations.
Debugging Query Performance
Slow queries can have two causes:- The query itself is slow, e.g. because it reads a lot of rows or uses unoptimized joins not backed by an index. The Fixing Slow Queries section describes how these queries can be optimized.
- The database is blocked. There can only be a single writer at a time, and the number of concurrent readers is bound by an option set when opening the database. So a query that appears slow might actually be fast, having run at an unfortunate time when the database was busy.
debugMode flag in the Web SDK logs all SQL queries on the Performance timeline in Chrome’s Developer Tools (after recording). This can help identify slow-running queries.
With the Dart SDK, queries are logged to the Performance View in DevTools by default outside of release builds.

Performance timeline in Chrome DevTools showing PowerSync query durations
- PowerSync queries from client code.
- Internal statements from PowerSync, including queries saving sync data, and begin/commit statements.
- The time spent waiting for the global transaction lock. It still includes all overhead in worker communication, so you generally won’t see concurrent queries reflected in the trace.
- Internal statements from
powersync-sqlite-core, used by the Sync client for Sync Stream bookkeeping.
PowerSyncDatabase:
WASQLiteVFS.OPFSWriteAheadVFS).
The Swift and Kotlin SDKs always use four read connections; React Native uses five.
For contention on the write connection, note that the PowerSync client processes changes from the PowerSync Service in a single write transaction
after they’ve been downloaded. Due to consistency requirements, this transaction cannot be split into multiple steps, and especially for a large initial
sync it can hold a write lock for several seconds.
Fixing Slow Queries
If a query itself is expensive and takes a long time to run, several options can improve performance. Some of these require a restructuring of your app’s schema.- For auto-updating watched queries on frequently-changed tables, queries might run very often. Watched queries should typically be cheap to run, as they otherwise risk blocking SQLite connections for too long. For more expensive queries that still need to be watched, consider increasing their throttle to run them less often.
- As an alternative to regular watched queries, use High Performance Diffs, which use triggers internally to only report changed rows back to your app.
- Where possible, filter on the
idcolumn of tables to reduce the number of rows read, which makes queries more efficient. When filtering on other columns of large tables, make sure these columns are covered by indexes declared in your app’s schema. - PowerSync tables are views over JSON data that extract columns by parsing from JSON each time a row is accessed. While SQLite has a cache for parsed JSON, this can still be inefficient for queries computing on columns. Raw Tables let you use plain SQLite tables instead, which are faster to query but require special consideration for migrations.