Why I stopped reaching for Redis first

2026-10-27来源 dev.to DatabaseEnglish

Every time a service got slow, my reflex was to add a cache. This week I finally ran the numbers on one of those services and found that the cache was hiding a bad query plan.

A quick EXPLAIN ANALYZE showed a sequential scan on a table that had grown 10x. Adding one composite index cut p99 from 900ms to 80ms — no cache needed.

Not saying Redis is bad (it's great, and we still use it). The lesson is just: measure before caching.

We're on Postgres 16 now, and the planner has been excellent once the statistics are fresh. Curious how others handle index review — manual, or automated in CI?

原文:https://www.a8q9.cn/en/article/why-i-stopped-reaching-for-redis-first-769b1a.html

相关文章