Skip to content

fix: apply WAL, NORMAL sync, and temp_store MEMORY pragmas to queue DB workers#47

Merged
manupawickramasinghe merged 1 commit into
devfrom
fix/sqlite-pragmas-temp-store
Jun 10, 2026
Merged

fix: apply WAL, NORMAL sync, and temp_store MEMORY pragmas to queue DB workers#47
manupawickramasinghe merged 1 commit into
devfrom
fix/sqlite-pragmas-temp-store

Conversation

@manupawickramasinghe

Copy link
Copy Markdown
Member

What

Adds three SQLite pragmas to the background queue worker connections in SqliteVecQueueDatabase._connect().

Why

SqliteQueueDatabase spawns background writer threads with their own SQLite connections via _connect(). These worker connections had zero performance pragmas set:

  • journal_mode=WAL — Write-Ahead Logging prevents readers from being blocked by writers. The main process reads while background workers write.
  • synchronous=NORMAL — Reduces fsync() frequency. Still fully safe in WAL mode (no corruption risk).
  • temp_store=MEMORY — Temporary tables and indexes stay in RAM instead of spilling to disk. On systems with sufficient free RAM (this target has ~4GB available), this avoids unnecessary disk I/O.

Note: mmap_size is deliberately NOT set. Letting SQLite pick its own default avoids committing address space on RAM-constrained systems (this targets a 14GB APU with shared GPU memory).

Files

  • frigate/db/sqlitevecq.py: 3 lines added

🤖 Generated with Claude Code

…B workers

Background writer threads from SqliteQueueDatabase create their own SQLite
connections through _connect() but weren't setting critical performance
pragmas. Without these, writes wait for fsync on every transaction, and
temp tables spill to disk.

Changes:
- journal_mode=WAL: prevents writers blocking readers
- synchronous=NORMAL: reduces fsync frequency, still safe with WAL
- temp_store=MEMORY: keeps temp tables/indexes in RAM (~4GB available)

No mmap_size set - let SQLite pick the default to avoid committing address
space on systems with limited RAM.

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 a2d4823 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