devroom.io/drafts/2009-04-23-compacting-a-sqlite3-db-file.md
Ariejan de Vroom dbae98c4c0 Moar updates
2013-03-24 14:27:51 +01:00

21 lines
649 B
Markdown

---
title: "Compacting a SQLite3 DB file"
kind: article
slug: compacting-a-sqlite3-db-file
created_at: 2009-04-23
tags:
- General
---
If you have a lot of mutations in your SQLite3 database the file size of the db file will increase a lot over time.
This can be annoying, so you'll need to clean up old indices and other cruft that's making your db heavy.
The solution is über-easy:
<pre lang="sh">$ sqlite3 mystuff.db
SQLite version 3.6.6.2
sqlite> VACUUM;
sqlite> .quit</pre>
Note that you need to use capitals here. This will clean your db file and reduce its file size dramatically (depending on the amount of cruft you have, of course).