Remove SQLite pragmas that set default values
- Remove page_size, wal_autocheckpoint, locking_mode, mmap_size - Keep only pragmas that change behavior from defaults - Increase cache size to 3GB (upper limit for 2.4GB database)
This commit is contained in:
parent
05805b8847
commit
9ef2a22db3
@ -98,18 +98,14 @@ func New(cfg *config.Config, logger *logger.Logger) (*Database, error) {
|
||||
|
||||
// Initialize creates the database schema if it doesn't exist.
|
||||
func (d *Database) Initialize() error {
|
||||
// Set SQLite pragmas for reasonable performance with better reliability
|
||||
// Set SQLite pragmas for performance
|
||||
pragmas := []string{
|
||||
"PRAGMA journal_mode=WAL", // Write-Ahead Logging (good default)
|
||||
"PRAGMA journal_mode=WAL", // Write-Ahead Logging
|
||||
"PRAGMA synchronous=OFF", // Don't wait for disk writes
|
||||
"PRAGMA cache_size=-524288", // 512MB cache (reasonable for 2.4GB DB)
|
||||
"PRAGMA cache_size=-3145728", // 3GB cache (upper limit for 2.4GB DB)
|
||||
"PRAGMA temp_store=MEMORY", // Use memory for temp tables
|
||||
"PRAGMA mmap_size=268435456", // 256MB memory-mapped I/O (reasonable default)
|
||||
"PRAGMA page_size=4096", // 4KB pages (SQLite default)
|
||||
"PRAGMA wal_autocheckpoint=1000", // Checkpoint every 1000 pages (4MB) - default
|
||||
"PRAGMA wal_checkpoint(TRUNCATE)", // Checkpoint and truncate WAL now
|
||||
"PRAGMA busy_timeout=5000", // 5 second busy timeout
|
||||
"PRAGMA locking_mode=NORMAL", // Normal locking for multiple connections
|
||||
"PRAGMA analysis_limit=0", // Disable automatic ANALYZE
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user