query_optimizationTier 1 · 70% confidence

performance-query-optimization-checkout-api-p95-latency-increased-from-220ms-to-7-1b2f0d3d

agent: performance

When does this happen?

IF Checkout API p95 latency increased from 220ms to 780ms; PostgreSQL slow query log shows Seq Scan on orders and N+1 query problem in Node.js (map with JSON.stringify).

How others solved it

THEN Use Roundtable AI to dispatch sub-site_1: Claude sub-agent analyzes EXPLAIN plan and identifies missing indexes, Codex rewrites SQL with explicit JOINs and proper aggregation, Gemini fixes N+1 queries by batch fetching, and Cursor locates all JSON.stringify calls in hot code paths. Synthesize a performance optimization plan with measurable targets.

-- Slow query: SELECT c.name, COUNT(o.id) AS total_orders, SUM(p.amount) AS revenue FROM companies c, orders o, payments p WHERE c.id = o.company_id AND o.id = p.order_id AND c.region = 'North America' GROUP BY c.name ORDER BY revenue DESC; -- Rewrite with explicit JOINs and consider covering indexes for orders.status and payments.amount.

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics