Lobsters·13wI Replaced Redis with PostgreSQL (And It's Faster)
PostgreSQL can replace Redis for caching, pub/sub, job queues, and sessions using UNLOGGED tables, LISTEN/NOTIFY, SKIP LOCKED, and JSONB. While PostgreSQL is 50-158% slower per operation (0.1-1ms difference), it eliminates network hops between databases, reduces infrastructure costs by ~$100/month, simplifies operations, and guarantees transactional consistency. The approach works best for small-to-medium apps with simple caching needs but isn't suitable for high-throughput scenarios (100k+ ops/sec) or applications requiring Redis-specific data structures like sorted sets or HyperLogLog.
