此次数据库优化主要聚焦在 SQLite 的稳定性与高并发读写效率:通过统一连接池参数、启用并细化 WAL 相关 PRAGMA(如自动 checkpoint 和日志大小上限)、增加后台 PASSIVE checkpoint 循环来抑制 -wal 文件膨胀;同时在高频路径引入更轻量的状态更新接口(避免全量 upsert),并对分页查询的 limit/offset 做边界保护,配合关键索引补齐,整体降低了锁竞争与慢查询风险。
This round of database optimization focused on SQLite stability and high-frequency workload efficiency: we standardized connection pool settings, tuned WAL pragmas (including auto-checkpoint and journal size limits), and added a background passive checkpoint loop to prevent long-term -wal growth. We also introduced lightweight update paths for heartbeat-style writes (instead of full upserts), enforced pagination bounds on limit/offset, and reinforced key indexes, which together reduce lock contention and slow-query risk.