A faster way to copy SQLite databases between computers – alexwlchan
08-May-2025 15
As the project matures and the database grows, this gets slower and less reliable. Downloading a 250MB database from my web server takes about a minute over my home Internet connection, and that’s pretty small – most of my databases are multiple gigabytes in size.
I’ve been trying to make these copies go faster, and I recently discovered a neat trick.
What really slows me down is my indexes. I have a lot of indexes in my SQLite databases, which dramatically speed up my queries, but also make the database file larger and slower to copy. (In one database, there’s an index which single-handedly accounts for half the size on disk!)
The indexes don’t store anything unique – they just duplicate data from other tables to make queries faster. Copying the indexes makes the transfer less efficient, because I’m copying the same data multiple times. I was thinking about ways to skip copying the indexes, and I realised that SQLite has built-in tools to make this easy.
A faster way to copy SQLite databases between computers – alexwlchan #ruby #rubydeveloper #rubyonrails #faster #SQLite #databases #between #computers #alexwlchan #databases #sqlite https://rubyonrails.ba/link/a-faster-way-to-copy-sqlite-databases-between-computers-alexwlchan