Cut p95 search latency from 900ms to 120ms
Profiled and rebuilt the product-search path: query planning fixes, a two-tier cache, and index redesign took p95 from ~900ms to ~120ms without adding infrastructure.
Sample note — seeded demo data illustrating the format. Real notes cite your real PRs.
Issue had been open for months: tenants with large catalogs saw search take over a second. Jane started with evidence, not guesses — EXPLAIN ANALYZE traces committed alongside the fix in showed the planner falling back to sequential scans because the trigram index didn't cover the filter columns queries actually used.
She replaced it with a composite GIN index matching the true access pattern and rewrote the hot query to stop defeating the planner with OR-chained filters. That alone took p95 from ~900ms to ~340ms.
added the second tier: a short-TTL cache with request coalescing, so a burst of identical queries during a traffic spike results in one database hit instead of hundreds.
Outcome: p95 ~120ms, p99 under 400ms, on the same hardware — verified by the load-test harness added in the same PR.