On 1/9/19, [email protected] <[email protected]> wrote: > In which order should VACUUM, INTEGRITY_CHECK and OPTIMIZE be executed?
I suppose that depends on what you are trying to accomplish? Why do you execute them at all? I suppose INTEGRITY_CHECK should be run with first opening the database file, to ensure that what you are opening really is a valid SQLite database. Maybe also run this after some other process that you do not trust writes to the file. Run VACUUM after deleting a lot of content. Maybe also run this after extensive changes when you want to optimize future access. The OPTIMIZE pragma uses information saved from prior queries run on the same database connection to try to determine whether or not ANALYZE should be run. If OPTIMIZE thinks ANALYZE should be run, it runs it for you automatically. Usually ANALYZE is not necessary and OPTIMIZE is a no-op, however. As OPTIMIZE uses statistics gathered from execution of prior queries on the same database connection, it is pointless to run it until later in the lifecycle of the database connection. -- D. Richard Hipp [email protected] _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

