small medium large xlarge

Back to: All Forums  Core Data
07 Oct 2009, 16:30
Dave Gallagher (1 post)

I was wondering if anyone knew of a way to VACUUM a Core Data SQLite database? By design (AFAIK), Core Data doesn’t perform VACUUM’s, which over time can lead to a fragmented SQLite file taking up lots of disk space. I posted this question on StackOverflow below, though wanted to place it here as more people are focused on Core Data here:

By design, Core Data does not issue a VACUUM SQL command to its SQLite database(s), as detailed here ( I’m creating a Core Data application that’ll store, and later delete, large binary files (2-10MB in size) in a SQLite db. Over time this will lead to fragmentation and a larger-than-necessary SQLite database. I’d like to periodically issue a VACUUM command, say, during a cleanup operation I run.

-How can I progmatically issue a VACUUM command to Core Data’s SQLite stores? -Is it possible to do this through Core Data, or must I mount the SQLite db and connect to it directly to execute the VACUUM SQL?

You must be logged in to comment