fix: change auto_vacuum from FULL to INCREMENTAL to reduce SSD write amplification#46
Merged
Merged
Conversation
…amplification FULL auto_vacuum rebuilds the entire database after every delete transaction, causing massive write amplification on NVMe flash storage. Frigate already runs a full VACUUM at startup (tracked via .vacuum sentinel), so per-transaction auto_vacuuming is redundant. INCREMENTAL mode tracks freed pages in a free list and reuses them for future inserts without rewriting the entire file, while still allowing manual VACUUM to reclaim space when needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR template validation failedThis PR was automatically closed because the description does not follow the pull request template. Issues found:
Please update your PR description to include all required sections from the template, then reopen this PR.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Changes SQLite
auto_vacuumfromFULLtoINCREMENTALinfrigate/app.py.Why
FULL auto_vacuum rebuilds the entire database file after every delete transaction. Frigate constantly deletes expired recording segments (every 3-7 days retention), so this triggers massive write amplification on flash storage — rewriting megabytes for kilobyte-sized deletions.
INCREMENTAL auto_vacuum tracks freed pages in a free list and reuses them for future inserts without rewriting the whole file. Manual
VACUUMstill works to reclaim space.Frigate already runs a full
VACUUMat startup (line 184) tracked via a.vacuumsentinel file, so per-transaction auto_vacuuming is redundant.Impact
Files
frigate/app.py: 1 line changed🤖 Generated with Claude Code