tangled
alpha
login
or
join now
atscan.net
/
atscand
1
fork
atom
wip
1
fork
atom
overview
issues
pulls
pipelines
update
tree.fail
4 months ago
5d8f62a3
7f0e1ca1
+15
-3
1 changed file
expand all
collapse all
unified
split
internal
storage
sqlite.go
+15
-3
internal/storage/sqlite.go
···
21
21
return nil, err
22
22
}
23
23
24
24
-
// Enable WAL mode for better concurrency
25
25
-
if _, err := db.Exec("PRAGMA journal_mode=WAL"); err != nil {
26
26
-
return nil, err
24
24
+
// Performance optimizations
25
25
+
pragmas := []string{
26
26
+
"PRAGMA journal_mode=WAL",
27
27
+
"PRAGMA synchronous=NORMAL", // Faster than FULL, still safe with WAL
28
28
+
"PRAGMA cache_size=-64000", // 64MB cache (negative = KB)
29
29
+
"PRAGMA temp_store=MEMORY", // Store temp tables in memory
30
30
+
"PRAGMA mmap_size=268435456", // 256MB memory-mapped I/O
31
31
+
"PRAGMA page_size=4096", // Optimal page size
32
32
+
"PRAGMA busy_timeout=5000", // Wait up to 5s for locks
33
33
+
}
34
34
+
35
35
+
for _, pragma := range pragmas {
36
36
+
if _, err := db.Exec(pragma); err != nil {
37
37
+
return nil, fmt.Errorf("failed to set pragma %s: %w", pragma, err)
38
38
+
}
27
39
}
28
40
29
41
return &SQLiteDB{db: db}, nil