perf: 系统性能优化 - 数据库索引、缓存、GZIP压缩和查询合并
- 添加3个复合索引提升查询性能 (user_date, user_category, destination) - 添加GZIP压缩和静态资源缓存 (maxAge: 1h) - 添加API响应no-cache头 - 添加stats端点2分钟内存缓存 (per-user key, LRU淘汰) - 合并多次数据库查询为单次查询 - 添加滚动防抖改善移动端体验 - 修复res.once内存泄漏问题 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
3a4048a29e
commit
df3a9daa65
@@ -40,6 +40,9 @@ db.exec(`
|
||||
CREATE INDEX IF NOT EXISTS idx_records_boss ON records(boss);
|
||||
CREATE INDEX IF NOT EXISTS idx_records_partner ON records(partner);
|
||||
CREATE INDEX IF NOT EXISTS idx_records_source ON records(source);
|
||||
CREATE INDEX IF NOT EXISTS idx_records_user_date ON records(user_id, created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_records_user_category ON records(user_id, category, created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_records_destination ON records(destination);
|
||||
`);
|
||||
|
||||
// 迁移:去掉 category 的 CHECK 约束
|
||||
|
||||
Reference in New Issue
Block a user