This particular usage uses the Turso Cloud to sync the local Turso databases and assumes that you have an account.
Overview
The sync engine uses a WAL (Write-Ahead Log) to track local writes. Over time, the WAL grows as you make changes. Checkpoint compacts it by transferring committed frames into the main database file and then truncating the WAL. Auto-checkpoint is disabled for sync databases — you must callcheckpoint() explicitly.
Why Checkpoint Matters
Without checkpointing, the WAL grows unbounded. After many writes, the WAL can become significantly larger than the database itself. Checkpointing reclaims that disk space. You can observe this withstats():
When to Checkpoint
Callcheckpoint() periodically based on your write patterns:
- After bulk inserts — if you insert many rows at once, checkpoint afterward to reclaim WAL space
- On a schedule — for steady write workloads, checkpoint at regular intervals (e.g. every few minutes)
- When WAL size is large — use
stats().mainWalSizeto monitor and checkpoint when it exceeds a threshold