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

link|improve this question

feedback

2 Answers

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.

link|improve this answer
Mail.app's "Envelope Index" sqlite3 db gets really large. This also impacts Mail.app'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 Mail.app 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
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.