You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.synchronous(SqliteSynchronous::Normal)// Full is not needed because we use WAL mode
367
389
.busy_timeout(Duration::from_secs(5))// No query should ever lock for more than 5 seconds
368
390
.foreign_keys(true)// By default SQLite does not do foreign key checks; we want them to ensure data consistency
369
-
.pragma("mmap_size","134217728")
391
+
// Caching:
392
+
.pragma("mmap_size",format!("{}",128*1024*1024))
370
393
.pragma("cache_size","-1000000")// Cache size of 10⁶ KiB AKA 1GiB (negative value means measured in KiB rather than in multiples of the page size)
371
-
// NOTE: we do _not_ set PRAGMA temp_store = 2 (MEMORY) because as long as the page cache has room those will use memory anyway (and if it is full we need the disk)
394
+
// NOTE: we do _not_ set PRAGMA temp_store = 2 (MEMORY) because as long as the page cache has room those will use memory anyway (and if it is full we need the disk)
395
+
// WAL checkpointing
396
+
.busy_timeout(Duration::from_secs(5))// Matches the SQLx default (*not* the sqlite-on-its-own default, which is 'error immediately'), but made explicit as it is subject to change
397
+
.pragma("wal_autocheckpoint","0")// Turn the passive autocheckpointing _off_, as we do our own explicit active checkpointing
398
+
.pragma("journal_size_limit",format!("{}",4*1024*1024))// Truncate WAL file down to 4 MiB after checkpointing
0 commit comments