feat(perf): 增加热查询索引审计

This commit is contained in:
2026-07-08 16:55:02 +08:00
parent 535f44175d
commit 69f50ea1f5
5 changed files with 705 additions and 0 deletions

View File

@@ -54,6 +54,13 @@ Run the hot-path harness against a running NestJS API:
pnpm perf:check -- --base-url http://localhost:3001/api/v1
```
Audit SQL plans and hot-path indexes:
```bash
pnpm perf:explain -- --dry-run
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ftb_pm pnpm perf:explain
```
## Hot Probes
`perf-check` measures p50 and p95 latency, records HTTP status code counts, and exits non-zero when a request fails or p95 exceeds the current query budget.
@@ -68,6 +75,8 @@ pnpm perf:check -- --base-url http://localhost:3001/api/v1
The medium fixture is the V2.6 acceptance target. Large fixture runs are for index audit and explain-plan work, not for every local commit.
See `docs/performance-hot-queries.md` for query budgets, partition-key contracts, and required indexes.
## Notes
- `seed-large-dataset` uses deterministic IDs and dates so repeated runs are comparable.