Skip to content

Tune SQLite pragmas to reduce lock contention#12

Merged
eirvandelden merged 1 commit into
mainfrom
ai/sqlite-config-tuning
Jul 5, 2026
Merged

Tune SQLite pragmas to reduce lock contention#12
eirvandelden merged 1 commit into
mainfrom
ai/sqlite-config-tuning

Conversation

@eirvandelden

Copy link
Copy Markdown
Owner

Summary

  • Adds temp_store, cache_size, and wal_autocheckpoint SQLite pragmas in config/database.sqlite.yml, on top of Rails' built-in WAL/synchronous defaults.
  • Ties the connection pool size to RAILS_MAX_THREADS (defaulting to 5, matching current behavior).
  • Loosens timeout/synchronous/mmap_size for the test environment to reduce lock contention during parallel test runs (the PARALLEL_WORKERS=1 workaround mentioned in AGENTS.md).

Test plan

  • Verified the YAML/ERB renders and merges correctly for development/test/production
  • Confirmed live pragma values via bin/rails runner in development, test, and production environments
  • Ran bin/rails test test/models with default parallelization; no new failures introduced (3 pre-existing failures reproduced identically without this change)

Adds temp_store/cache_size/wal_autocheckpoint tuning on top of Rails'
built-in WAL defaults, ties pool size to RAILS_MAX_THREADS, and loosens
synchronous/mmap_size/timeout in test to address the SQLite lock
contention that PARALLEL_WORKERS=1 currently works around.
@eirvandelden eirvandelden merged commit c9effb3 into main Jul 5, 2026
2 of 9 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.

1 participant