Get the latest tech news

Redis is fast – I'll cache in Postgres


There are books & many articles online, like this one arguing for using Postgres for everything. I thought I’d take a look at one use case - using Postgres instead of Redis for caching. I work with APIs quite a bit, so I’d build a super simple HTTP server that responds with data from that cache. I’d start from Redis as this is something I frequently encounter at work, switch it out to Postgres using unlogged tables and see if there’s a difference.

I work with APIs quite a bit, so I’d build a super simple HTTP server that responds with data from that cache. As has been the story so far, the CPU stayed put at ~1280mCPU, RAM usage grew a bit due to the new keys being inserted. The unlogged table makes a huge difference for the write benchmark and a somewhat smaller but still significant one for the mixed workload.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Postgres

Postgres

Photo of redis

redis

Photo of cache

cache

Related news:

News photo

Cache of devices capable of crashing cell network is found in NYC

News photo

PlanetScale for Postgres is now GA

News photo

What if we treated Postgres like SQLite?