On 2017/09/01 6:53 PM, Jacky Lam wrote:
What I am understood from the answer is explicit code must be used during
creating db, for example, auto_vacuum=FULL.
If no, the file size will not reduce even deleting a number of records and
this is normal.

Yes. If you create the database and run the SQL (among your other set-up statements) "auto_vacuum=FULL;" then it will automatically vacuum the DB when appropriate (such as when you close a connection after deleting stuff).

If however you haven't done that, you can at any time simply run the SQL statement "VACUUM;" and it will vacuum the DB right on the spot.

Note also that the saving in disk space might not correlate 100% with the deleted rows. Vacuum re-packs the rows (remaining in the DB) and get rids of empty (aka "Free") pages. Pages are acquired and freed in the DB's page-size (see pragma page_size setting) and such size may or may not encompass one, less than one, or several rows depending on the row data sizes, and as such any specific page may or may not be completely filled with a data payload after vacuuming.


_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to