Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any disadvantages of vacuuming sqlite databases? If not, why don't applications vacuum their dbs?

share|improve this question
up vote 1 down vote accepted

Vacuuming recreates the db file from the existing file, and as such it needs extra disk space to run. It also takes some time to do so, and requires a lock to keep things consistent.

So, people chose to not have to deal with the lock and space issues and let the db grow, hoping it doesn't grow too big.

You can do an auto_vacuum which doesn't clean as much on deletes, but doesn't lock the db for any time either.

share|improve this answer's "Envelope Index" sqlite3 db gets really large. This also impacts's startup time. – Max Ried Jun 29 '11 at 21:10
@bot47 Yeah, mail is a particularly bad usage model for dbs. A lot of deletes. I'd write so that it would vacuum on app shutdown. MacOS X comes with command line tools for sqlite2, you could probably wrine script to vacuum it yourself. – Rich Homolka Jun 29 '11 at 21:44

Vacuuming a SQLite DB basically just saves/"compacts" disk space -- it has very little effect on performance. Most apps would not benefit much from vacuuming unless they delete large amounts of data.

share|improve this answer

Be aware that vacuuming an sqlite db can recreate the _id column with new id's. So if you are heavily relying on data integrity or data matching based on _id, then make sure you can accomodate this scenario.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .