Auto-vacuuming is only possible if the database stores some additional information that allows each database page to be traced backwards to its referrer. Therefore, auto-vacuuming must be turned on before any tables are created. It is not possible to enable or disable auto-vacuum after a table has been created.
In mode DB_AUTO_VACUUM_INCREMENTAL the additional information
needed to do auto-vacuuming is stored in the database file but
auto-vacuuming does not occur automatically at each commit as it does
with DB_AUTO_VACUUM_FULL. In incremental mode, the separate
incremental_vacuum pragma must be invoked to cause the auto-vacuum to
occur.
The database connection can be changed between full and incremental
auto-vacuum mode at any time. However, changing from
DB_AUTO_VACUUM_NONE to DB_AUTO_VACUUM_FULL or
DB_AUTO_VACUUM_INCREMENTAL can only occur when the database is new
(no tables have yet been created) or by running the VACUUM command.
The function returns the following error codes:
E_DB_PREPARE if statement preparation failed.E_DB_STEP if step execution failed or no write permission.E_INVALID if the auto-vacuum mode is invalid.E_READ_ONLY if database is opened read-only.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database type. |
||
| integer, | intent(in) | :: | mode |
Database auto vacuum mode. |