Skip to main content

execute_vacuum

Function execute_vacuum 

Source
pub fn execute_vacuum(db: &mut Database) -> Result<String>
Expand description

Executes VACUUM; (SQLR-6). Compacts the database file: rewrites every live table, index, and the catalog contiguously from page 1, drops the freelist, and truncates the tail at the next checkpoint.

Refuses to run inside a transaction (would publish in-flight writes out of band); refuses on read-only databases (handled upstream by the read-only mutation gate); and is a no-op on in-memory databases (no file to compact). Bare VACUUM; only — non-default options (FULL, REINDEX, table targets, etc.) are rejected.