Redis vs Postgres for AI Agent Memory, Actually Measured

Redis beat PostgreSQL on both write and read latency at small scale, but by less than half a millisecond per operation: 0.109ms vs 0.188ms write, 0.105ms vs 0.171ms read.

PostgreSQL's p99 write latency was 1.09ms, about 4x Redis's 0.27ms p99 -- the tail is where PostgreSQL's WAL, indexing, and MVCC overhead actually shows up, not the average case.

PostgreSQL can filter agent memory by its contents directly in 2.3ms with plain SQL; plain Redis cannot do this at all without a secondary index product like RediSearch.

Read the full post

Read the full post