mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-26 02:00:52 +01:00
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>