Migrating from PostgreSQL/MySQL to SQLite: When and How to Make the Switch
SQLite, especially via Turso Cloud, can replace PostgreSQL or MySQL for read-heavy, moderate-write workloads, trading complex-JOIN optimization, stored procedures, rich types and native replication for simpler operations, lower cost and local reads. Migration steps: dump schema and data as INSERT statements with pg_dump or mysqldump, translate types (SERIAL to INTEGER PRIMARY KEY, BOOLEAN to INTEGER, arrays to JSON text), convert to WAL mode and checkpoint, then import with `turso db import` or the Platform API upload flow (up to 20GB). Before cutover, compare query plans, load test at p50/p95/p99, and verify that write patterns tolerate SQLite's single-writer model or use Turso's MVCC-based BEGIN CONCURRENT.
Related posts
- Migrating data from MySQL to Turso
Turso mediumAdeptMoving a MySQL database to Turso takes three commands: dump it with mysqldump using --skip-extended-insert, convert the dump to a SQLite file with the mysql2sqlite script piped into sqlite3, then create a Turso database from that file with `turso db create --from-file`. Row counts can be checked with the sqlite3 shell after conversion and with `turso db shell` after import. Larger migrations may hit issues that need extra help.
- Turso Sync: Local-First SQLite with Push and Pull
Turso mediumAdeptTurso Sync replaces libSQL's page-based Embedded Replicas with logical row-level changes captured via CDC in Turso Database, a Rust rewrite of SQLite, so reads and writes stay local and apps call push() and pull() explicitly. Shipping logical statements instead of WAL pages lets unrelated writes merge on the server. Experimental partial sync fetches 128 KiB segments on demand, with optional prefetch. Benchmarks show roughly 7–10x speedups and about 15x less data for small-write workloads, but only 1.2x when writes are already batched. Conflicts resolve by last-push-wins, which suits single-writer data but loses updates on shared counters unless data is modeled append-only.
- You can now migrate your existing databases to AWS
Turso mediumAdeptTurso paid-plan users can move database groups from Fly.io to AWS with new `turso group aws-migration info/start/abort` CLI commands; free-tier users have already been migrated. Migration is irreversible, keeps databases read-only with writes paused (usually under a minute, longer for 1 GB+), and drops features such as cross-database ATTACH, multi-DB schemas, server-side WebSockets, edge replicas and some extensions like sqlite-vss. Embedded replicas need their local files deleted and re-synced because the on-disk format and protocol differ. For remote writes, use execute/run paths without RETURNING, keep transactions short, avoid cached write statements, and reconnect and retry on stream errors, with SDK-specific guidance for JS, Python and Go or a switch to the new Turso Sync push-based packages.
- How we migrate TBs from Heroku without logical replication
PlanetScale mediumAdeptPlanetScale's open-source Heroku Migrator moves multi-terabyte Postgres databases off Heroku standard plans, which lack WAL access and logical replication, by using Bucardo trigger-based replication: triggers record changes in delta tables, a one-time COPY loads existing data, and a worker replays the backlog before a controlled switchover with verification. Version 2.0 fixes failures seen on large migrations. Bucardo's single-transaction initial copy restarted from zero after any interruption, so the migrator now drops secondary indexes before the copy and rebuilds them in parallel afterwards, raising throughput from about 60 to nearly 300 GB/h. It also disables transaction_timeout on Bucardo's connections, sets TCP keepalives so silently dropped long-lived connections fail within about a minute, and tunes host TCP buffers. A discovery CLI and the Liftoff assessment flag tables without primary keys, incompatible extensions and sizing before the migration starts.
- Turso v0.4.0
Turso mediumAdeptTurso v0.4.0 overhauls its experimental MVCC mode, which lifts SQLite's single-writer limit, adding index support, checkpointing and recovery. MVCC is now enabled with `PRAGMA journal_mode = 'experimental_mvcc'`, persisted in the file header, and makes the file unreadable by stock SQLite until you switch back to WAL. Partial sync fetches pages on demand, with bootstrap queries and prefetching (persistent mode is Linux-only because it needs sparse files), and sync now ships in the Python and Go SDKs. The release also adds page cache spilling for large queries, ANALYZE support for better join ordering, and a disk-spilling hash join for non-indexed columns in place of SQLite's ephemeral B-tree indexes.