Files
PaperClipAI/packages
DottaandClaude Fable 5 ad42f04efb perf(db): index cost_events issue sums and session token lookups
The productivity-review sweep sums cost_cents per candidate issue every
30 seconds, and cost_events has no index on issue_id, so each sum reads
every cost event the company recorded (~21k rows, ~168ms cold; 51B
tuples read via 1.8M seq scans since Jul 23). Session auth resolves the
bearer token on every request against a session table with no token
index (1.6M seq scans).

Add cost_events(company_id, issue_id) and a unique index on
session(token), with an embedded-postgres test covering index presence,
planner usage, and migration idempotency.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-27 14:38:14 +00:00
..