fix: apply WAL, NORMAL sync, and temp_store MEMORY pragmas to queue DB workers#47
Merged
Merged
Conversation
…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>
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
Adds three SQLite pragmas to the background queue worker connections in
SqliteVecQueueDatabase._connect().Why
SqliteQueueDatabasespawns 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— Reducesfsync()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_sizeis 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