Talking about WHEN making the service job: what about doing this at db close time ?
Doing so at launch time makes the user feeling that this takes long time,
Doing so after launch time but before close time: you already talk about that (and the potential troubles),
Doing that at close time: the user is tired after that db stuff session and start the close process, then takes a cup of tea-coffee-sympathy-cigarette (no, not this)-whatever and when back, the optimization is done.
This can even be said in the documentation.
While I am talking about the documentation
While I still have the pdf handly, here’s its URL (as html page).
And heres the relevant part:
sqlite> PRAGMA auto_vacuum = NONE; -- 0 means disable auto vacuum
sqlite> PRAGMA auto_vacuum = INCREMENTAL; -- 1 m eans enable increm ental vacuum
sqlite> PRAGMA auto_vacuum = FULL; -- 2 means enable full auto vacuum
I just get an eye on how I wrote this earlier:
[code] db.SQLExecute(“BEGIN TRANSACTION”)
db.SQLExecute(“PRAGMA foreign_keys=ON”)
db.SQLExecute(“PRAGMA auto_vacuum=FULL”)[/code]
This is the order of appearance of the code (I stripped comments, and If error(s) blocks)
auto_vacuum appears on third position (it could be worse
). [The Tables are created after, just after !]
I found, at last, where in sqlite.com the auto_vacuum order of appearance is said: PRAGMA .
Search the string:
“PRAGMA schema.auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL;” (without the quotes).
I want to thank publicly: Richard for the question and Rick for the answer.
I took some minutes yesterday to finish the addition of VACUUM and check immediately (on a very low sized db) and it worked fine !
To be clear, when (that) SQLite db file is build at save (or save as) time, and it is
VACUUMed (?) before I cloe the db reference / quit the Save Method.
For the ellapsed time ? I do not know, the test db was around 50KB (before I remove many Records) to some 5KB ? (once saved with less than 5 Records
).