mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-30 19:46:38 +08:00
Optimize home/library loading and SQLite query performance
- Replace home preview N+1 queries with a single window-function batch query - Cache library previews and series card lists (15s TTL, shared with media cache) - Tune SQLite: larger page cache, mmap, wal_autocheckpoint, ANALYZE on migrate - Defer history fetch on library page until last_played sort is selected - Yield to browser between paginated library loads to keep UI responsive Co-authored-by: truewhile <truewhile@users.noreply.github.com>
This commit is contained in:
@@ -114,7 +114,10 @@ func buildSQLiteDSN(cfg *config.Config) string {
|
||||
if cfg.Database.CacheSize != 0 {
|
||||
dsn += fmt.Sprintf("&_pragma=cache_size(%d)", cfg.Database.CacheSize)
|
||||
}
|
||||
dsn += "&_pragma=temp_store(MEMORY)&_pragma=mmap_size(268435456)"
|
||||
dsn += "&_pragma=temp_store(MEMORY)&_pragma=mmap_size(536870912)"
|
||||
if cfg.Database.WALMode {
|
||||
dsn += "&_pragma=wal_autocheckpoint(1000)"
|
||||
}
|
||||
return dsn
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user