Menu

1 / 2

Why I stopped reaching for Redis first

DEV Community: postgres·Kendall Ellis·about 3 hours ago
#hc0OUeT7
#devtopostgresql#devto#dev#cache#index
Reading 0:00
15s threshold

Kendall Ellis

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?