Created
December 6, 2024 17:35
-
-
Save james2doyle/74cc98afda6b1ee8fdf2d5076aa1fe15 to your computer and use it in GitHub Desktop.
Here is a list of sensible defaults when using sqlite https://briandouglas.ie/sqlite-defaults/
This file contains 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
-- @see https://briandouglas.ie/sqlite-defaults/ | |
-- Set the journal mode to Write-Ahead Logging for concurrency | |
PRAGMA journal_mode = WAL; | |
-- Set synchronous mode to NORMAL for performance and data safety balance | |
PRAGMA synchronous = NORMAL; | |
-- Set busy timeout to 5 seconds to avoid "database is locked" errors | |
PRAGMA busy_timeout = 5000; | |
-- Set cache size to 20MB for faster data access | |
PRAGMA cache_size = -20000; | |
-- Enable foreign key constraint enforcement | |
PRAGMA foreign_keys = ON; | |
-- Enable auto vacuuming and set it to incremental mode for gradual space reclaiming | |
PRAGMA auto_vacuum = INCREMENTAL; | |
-- Store temporary tables and data in memory for better performance | |
PRAGMA temp_store = MEMORY; | |
-- Set the mmap_size to 2GB for faster read/write access using memory-mapped I/O | |
PRAGMA mmap_size = 2147483648; | |
-- Set the page size to 8KB for balanced memory usage and performance | |
PRAGMA page_size = 8192; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment