SQLite Forum

autovacuum in sqlite VS autovacuum in PG
Login
1. No (No and No).

That is, update/delete does not generate multiple copies of each record (tuple).  Each tuple has only one data entry.  Ever.  Update is not done in place but rather the old tuple is removed and a new one inserted.

2. Not relevant.

When a page becomes free (via whatever mechanism causes the page to become free) it is added to the freelist (just as it does when there is no auto vacuum in effect).  Enabling auto_vacuum causes extra information to be recorded in the database so that pages may be diddled-about (moved).

WHen the automatic vacuum is triggered (whether automagically for every commit or user activation via explicit command, as was specified by the user) the "extra information" stored in the database when auto-vacuum is enabled is used to move freelist pages to the end of the database file, whereupon the database in truncated to release the free pages to the Operating System.

There is no way for a layman to determine whether DELETE or UPDATE will cause more pages to be added to the freelist.

For example, if you have a table `create table x(x integer not null check (x in (0,1))` and a table `create table y(data blob not null)` where the blob is 2 terrabytes, then updating one row of y will "free" 2 terrabytes of disk space, while in the former case you have to delete about 1.8 trillion rows from x to achieve the same "freeing" of disk space.