feat(status): 启用 pg_stat_statements,运行状态页显示最慢 / 最频繁语句与各表死元组;PG 调低 random_page_cost
- docker-compose.yml 的 postgres 加 shared_preload_libraries=pg_stat_statements、pg_stat_statements.track=top; 要重建 postgres 容器才生效(docs/runbook/storage.md) - GET /system/storage 的 db.statements:平均最慢(调用 ≥ 10 次)与调用最多各 5 条;没装扩展 / 没预加载时 enabled=false 并说明原因 - 运行状态页「存储」:体积最大的表加死元组列,新增「数据库语句统计」 - random_page_cost 4 → 1.1(PG_RANDOM_PAGE_COST):库整个在内存里,缺省值高估随机读 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
8c8b252667
commit
63bbcf3cdb
5 files changed
+163
-1
No files matched your search
@@ -287,6 +287,9 @@ describe.skipIf(!hasPg)("CACHE-2 存储(真实 PG)", () => {
|
||||
const obs = d.cleanup.find((c) => c.target === "observation")!;
|
||||
expect(obs).toMatchObject({ jobId: "storage.retention.observation", retention: "90 天" });
|
||||
expect(d.cleanup.find((c) => c.target === "heartbeat")?.retention).toBe("24 小时");
|
||||
expect(d.cleanup.find((c) => c.target === "pipeline")).toMatchObject({ jobId: "storage.retention.pipeline" });
|
||||
// 语句统计:测试库没有预加载 pg_stat_statements 时给出原因,不报错
|
||||
if (!d.db.statements.enabled) expect(d.db.statements.note).toMatch(/pg_stat_statements/);
|
||||
expect(d.level).toBe("ok");
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user