Skip to content

fix: change auto_vacuum from FULL to INCREMENTAL to reduce SSD write amplification#46

Merged
manupawickramasinghe merged 1 commit into
devfrom
fix/auto-vacuum-incremental
Jun 10, 2026
Merged

fix: change auto_vacuum from FULL to INCREMENTAL to reduce SSD write amplification#46
manupawickramasinghe merged 1 commit into
devfrom
fix/auto-vacuum-incremental

Conversation

@manupawickramasinghe

Copy link
Copy Markdown
Member

What

Changes SQLite auto_vacuum from FULL to INCREMENTAL in frigate/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 VACUUM still works to reclaim space.

Frigate already runs a full VACUUM at startup (line 184) tracked via a .vacuum sentinel file, so per-transaction auto_vacuuming is redundant.

Impact

  • Reduces SSD/NVMe write cycles
  • Faster delete operations (no full DB rebuild per delete)
  • No behavioral change — database is still compacted at startup

Files

  • frigate/app.py: 1 line changed

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings June 10, 2026 20:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

PR template validation failed

This PR was automatically closed because the description does not follow the pull request template.

Issues found:

  • Missing section: ## Proposed change
  • Missing section: ## Type of change
  • Missing section: ## AI disclosure
  • Missing section: ## Checklist
  • The Proposed change section is empty. Please describe what this PR does.

Please update your PR description to include all required sections from the template, then reopen this PR.

If you used an AI tool to generate this PR, please see our contributing guidelines for details.

@github-actions github-actions Bot closed this Jun 10, 2026
@manupawickramasinghe manupawickramasinghe merged commit d95cf72 into dev Jun 10, 2026
4 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants