How to VACUUM a Core Data SQLite db?
The supported way to do this, on OS X 10.6 / iOS 3.0 and later, is to set the NSSQLiteManualVacuumOption in the options when you are adding the store to the persistent store coordinator.
Yes, vacuum
is a recognized SQL statement in SQLite. It can be used as a normal query, or so it says.
Beware, though, as it can lead to excessive file system reads and writes—the bottleneck of practically any system—not to mention server file system fragmentation on Windows servers.