El 02-03-2006, a las 13:35, [EMAIL PROTECTED] escribió:
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.

I have noticed that when I import a lot of data (40-50k rows) into my application and run a select (fairly complex with joins) afterwards it will be a bit slow (fragmented indexes or something), but rerunning the select after a vacuum; will *GREATLY* speed up matters. This doesn't seem to happen if I set the autovacuum flag, vacuum still seems to do something different.

Any ideas?

-- Tobias

Reply via email to