mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
perf(usage): 优化 admin usage records 查询性能
- count 查询按需 JOIN,避免不必要的表关联 - 前端 onMounted 将 stats/heatmap/records/users 全部并行加载 - 调整缓存 TTL(聚合 30s->60s,列表 10s->15s) - 为 request_candidates 添加复合索引优化 fallback/retry 查询
This commit is contained in:
@@ -2203,6 +2203,10 @@ class RequestCandidate(Base):
|
||||
Index("idx_request_candidates_status", "status"),
|
||||
Index("idx_request_candidates_provider_id", "provider_id"),
|
||||
Index("idx_request_candidates_created_at", "created_at"),
|
||||
# 复合索引: 按 request_id + status 查询 fallback/retry 场景
|
||||
Index("idx_rc_request_id_status", "request_id", "status"),
|
||||
# 复合索引: 按 provider 聚合统计(provider_id + status + created_at)
|
||||
Index("idx_rc_provider_status_created", "provider_id", "status", "created_at"),
|
||||
)
|
||||
|
||||
# 关系
|
||||
|
||||
Reference in New Issue
Block a user