perf(management): message补无渠道前缀索引——修驾驶舱channel=all超时34s→1.3s

该回未回决赛圈点查(owner+talker定位末条消息)在channel=None时无渠道
前缀条件,现有索引全以channel打头用不上,服务器100万行实测dashboard
34~37s撞前端15s超时(ECONNABORTED);补(owner,talker,timestamp)索引
后实测1.3~1.8s。服务器已先行手工建索引止血,本迁移幂等兜底对齐。
模型+迁移双声明防autogenerate反DROP
This commit is contained in:
浅念
2026-09-10 15:26:25 +08:00
parent 80b721b84f
commit 682249a3fd
2 changed files with 53 additions and 0 deletions
+12
View File
@@ -537,6 +537,18 @@ class Message(Base):
"ix_message_fetched_at",
"fetched_at",
),
# 该回未回决赛圈点查(owner+talker 定位末条消息)在 channel=None
# (全平台计数——管理驾驶舱 action_counts 复用)时无渠道前缀条件,
# 上面全部以 channel 打头的索引用不上,逐候选退化扫表+filesort:
# 2026-09-10 服务器实测 dashboard 34~37s 撞前端 15s 超时
# (ECONNABORTED);补无渠道前缀索引后 1.3~1.8s(100 万行在线建
# 索引 49s)。「模型+迁移双声明」防 alembic autogenerate 反 DROP。
Index(
"ix_message_owner_talker_time",
"owner_account_id",
"talker_id",
"timestamp",
),
)