0

I have a rather large sqlite3 database that I've built/populated through python over a few months. I have done many inserts/deletes etc while putting it together and it now uses the majority of my diskspace so I don't have enough disk space left to add a required index/do other things I need to do on it.

I found out about the 'VACUUM;' command which sounds like it will help reduce the disk space my database uses, however as it makes a copy it needs more spare diskspace than I have to run it (I have already deleted as many other files as I possibly can). Is there any way to run the VACUUM in bits/chunks to avoid needing so much spare disk space? Or are there any other things I could do to help reduce the size of my database?

1 Answer 1

1

Use VACUUM INTO filename; where filename is a full path on another disk (even a removable one). This will leave your original db unchanged and will not require space from the origin disk. After the Vacuum completes, you can copy the vacuumed db over the original one.

Reference: https://www.sqlite.org/lang_vacuum.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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