Skip to main content

save_database

Function save_database 

Source
pub fn save_database(db: &mut Database, path: &Path) -> Result<()>
Expand description

Persists db to disk. Diff-pager skips writing pages whose bytes haven’t changed; the PageAllocator preserves per-table page numbers across saves so unchanged tables produce zero dirty frames.

Pages that were live before this save but aren’t restaged this round (e.g., the leaves of a dropped table) move onto a persisted free list rooted at header.freelist_head; subsequent saves draw from the freelist before extending the file. VACUUM (see vacuum_database) compacts the file by ignoring the freelist and allocating linearly from page 1.