"Eggert, Henri" <[EMAIL PROTECTED]> wrote: > Hi all, > > I use sqlite 3.3.4 and I am very happy with it - it is very fast. > > But I wonder : > > if I have a db ~ 1gb and I delete all the data in the tables ( db is > than nearly empty ) > Issuing a vacuum command takes a long time ( several minutes ). > Why ? > Is there a way to "vacuum" faster ? >
The VACUUM command does something very much like this: sqlite3 olddb .dump | sqlite3 newdb; mv newdb olddb I say "much like" the above because there are some important differences. The VACUUM command transfers the data from the old and new database in binary without having to convert it into text. And the whole operation is protected by a rollback journal so that if a power failure occurs in the middle, the operation will rollback. But the point is this: VACUUM recreates the whole database from scratch. The time required is proportional to the amount of data that is in the database. -- D. Richard Hipp <[EMAIL PROTECTED]>