Stop scaling and start tuning
summary
Team uses App Insights and Zipkin traces to find an N+1 that makes a page go 7.8s, fixes it with eager loading or batching to ~390–415ms, then adds indexes on created_at and order_id to drop a 250ms query to ~47ms (5x). PGAdmin + EXPLAIN/plan reveals sequential scans. Sporadic 2+ second gaps trace to a tiny DB connection pool; limiting parallelism (p‑map / concurrency) and right‑sizing the pool removes the stalls.
AI-written summary · about
