Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

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
    
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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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