Commit d9b116e
committed
perf(db): cap WAL size + tune optimize sample for better plans
Two SQLite tuning knobs that round out the existing perf-pragma block:
- PRAGMA journal_size_limit = 64 MB. Without this, a sustained-write
burst (CSV import, batch op storm) can grow the WAL file to
gigabytes before the next checkpoint truncates it. On small VPS
boxes (1 GB / 25 GB disk) that fills the disk before the operator
notices. The limit is advisory — SQLite shrinks the WAL on the next
checkpoint, never blocks writes.
- PRAGMA analysis_limit = 400 prior to PRAGMA optimize. Default sample
is 100 rows per index; 400 produces noticeably better statistics on
tables with skewed distributions (audit_log by action, logs by
status code, record_history by collection) at no measurable boot
cost. Pairs with the existing PRAGMA optimize call.
637 tests pass.1 parent 167c45a commit d9b116e
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
57 | 68 | | |
58 | 69 | | |
59 | 70 | | |
| |||
0 commit comments