Repository navigation
Open
Description
Environment
@powersync/web2.3.1,@powersync/common2.2.1,@powersync/shared-internals1.2.0,@powersync/vue0.6.0,@powersync/kysely-driver2.0.1,@powersync/capacitor0.9.1- WASM SQLite over
IDBBatchAtomicVFS(no SharedArrayBuffer / COOP-COEP), Quasar/Vue 3 dev server, Chrome - Sync service:
journeyapps/powersync-service:1.26.0, source Postgres 16, sync rules with one parameter bucket (org) + a branch-scoped stream - Dataset: 6,383
products+ 6,383branchStock+ 2,000transactions+ 2,000transactionProductsrows replicated locally; all rows stored in the defaultps_data__<table>(id, data)JSON layout with auto-generatedjson_extractviews
Symptom
Every page load, after connect() resolves, all local reads stall for a deterministic ~30 seconds, then complete together. Steady-state reads on the same store run in 5–25 ms.
Measured with instrumentation around database.getAll (page-age timestamps):
| probe | result |
|---|---|
| boot phases (init / schema / stores / subscribe) | 0 / 3 / 11 / 22 ms |
connect() + fetchCredentials |
82–150 ms, token mint in 15 ms |
| catalogue SELECT (LIMIT 20, via views) | started @ 555 ms after load, ran 29,503 ms |
| catalogue count | ran 29,180 ms, completed at the same instant |
SELECT count(*) FROM "branches" (1 row) issued mid-round |
13,141 ms |
| same catalogue SELECT after the round settles | 11–25 ms |
| server-side checkpoint | New checkpoint → checkpoint_complete in 24–48 ms (ms: {bucket_data: 1, checksum: 27, parameters: 16, total: 48}), data_synced_bytes: 2767, operations_synced: 0 |
The determinism is the striking part: consecutive reloads produce 29.7 s and 29.5 s almost to the millisecond, with zero errors logged client- or server-side, and with essentially nothing to download.
What we ruled out
- Server/service: checkpoints issue in 24–48 ms; the replication slot is healthy and caught up.
- Query plans: the affected SQL is identical to queries we run manually post-round (11–25 ms through the same
getAllpath). The app's queries start immediately (firstgetAllbegins at page-age 555 ms) and spend the wall inside the SDK. - Indexes: expression indexes on every joined/filtered/sorted column (verified used via
EXPLAIN QUERY PLAN); post-round queries are fast with them present. - Credentials: no auth failures or retry storms in the measured boots.
- WASM thread: a direct
getAllissued mid-round completes in 13 s while the app's larger queries are still pending, so the worker is not simply CPU-pegged on one statement — reads appear to be serialized behind repeated write/commit work.
Observations that look abnormal
ps_oplogcurrently holds 23,195 rows and never shrinks — across many connect/sync cycles its count is frozen. We would have expected applied download journal entries to be pruned.- Deleting
ps_oplogmanually did not fix the round cost (and the count stays 0 afterwards), so the ~30 s is not only journal replay — but the never-vacuating journal still looks like a bug on its own. - Every connect re-runs the same deterministic local work over the full store even when
operations_synced: 0— the cost appears to scale with total local rows (checkpoint/bucket reconciliation over the JSON rows), not with the delta.
Ask
- Is a ~30 s post-connect round on a ~6.4k-row store expected for this storage backend, or is this a known hot path (oplog bookkeeping / bucket checksum computation row-by-row over
json_extractviews)? - Is
ps_oplogsupposed to be vacuumed after checkpoints in the web SDK? If yes, what would prevent it? - Any guidance on keeping reads flowing during the post-connect round (separate read connection, deferred checksum validation, configuration), or whether a fix is planned?
Happy to provide the full instrumented timelines or run dev builds against our reproduction.
Metadata
Metadata
Assignees
Labels
No labels
Activity
simolus3 commentedon Sep 20, 2026
No, a sync operation on a mostly up-to-date client should be very fast without holding any database locks that long.
For debugging purposes, could you try setting
enableMultiTabs: falseanddebugMode: trueas options when opening databases? This logs the actual query time without time spent waiting for a worker to be available (disabling multi-tab ensures the sync client runs in the local context, logging query times for internal statements too). It would be interesting to see query times for queries withpowersync_controlin their SQL text.It would also be interesting to see the results of
SELECT COUNT(1) FROM ps_updated_rowsbefore you callconnect().No, we need to preserve most of the operation history to be able to reconstruct the correct state for cases where a local write is uploaded but ignored by your backend (the correct behavior for those cases is to revert the write on the client too, so we need to keep the history).
Chriztiaan commentedon Nov 3, 2026
@princehaon could you provide more information if possible?