Live data from Hacker News

It's 2026, Just Use Postgres

tigerdata.com

31–40 of 349 posts

Re: It's 2026, Just Use Postgres

#31

Caching is mentioned in the article: What do you guys feel about using PostgreSQL for caching instead of Redis? Redis is many times faster, so much that it doesn't seem comparable to me. A lot of data you can get away with just caching in-mem on each node, but when you have many nodes there are valid cases where you really want that distributed cache.

Prove that you need the extra speed.

Run benchmarks that show that, for your application under your expected best-case loads, using Redis for caching instead of PostgreSQL provides a meaningful improvement.

If it doesn't provide a meaningful improvement, stick with PostgreSQL.

Re: It's 2026, Just Use Postgres

#32

Caching is mentioned in the article: What do you guys feel about using PostgreSQL for caching instead of Redis? Redis is many times faster, so much that it doesn't seem comparable to me. A lot of data you can get away with just caching in-mem on each node, but when you have many nodes there are valid cases where you really want that distributed cache.

Neither.

Just use memcache for query cache if you have to. And only if you have to, because invalidation is hard. It's cheap, reliable, mature, fast, scalable, requires little understanding, has decent quality clients in most languages, is not stateful and available off the shelf in most cloud providers and works in-clusetr in kubernetes if you want to do it that way.

I can't find a use case for Redis that postgres or postgres+memcache isn't a simpler and/or superior solution.

Just to give you an idea how good memcache is, I think we had 9 billion requests across half a dozen nodes over a few years without a single process restart.

Re: It's 2026, Just Use Postgres

#33
post #15

Blog posts, like academic papers, should have to divulge how AI has been used to write them.

Granted it's often easy to tell on your own, but when I'm uncertain I use GPTZero's Chrome extension for this. Eventually I'll stop doing that and assume most of what I read outside of select trusted forums is genAI.

Re: It's 2026, Just Use Postgres

#34

Skeptical about replacing Redis with a table serialized to disk. The point of Redis is that it is in memory and you can smash it with hot path queries while taking a lot of load off the backing DB. Also that design requires a cron which means the table could fill disk between key purges.

From the article, using UNLOGGED tables puts them in memory, not on disk

Re: It's 2026, Just Use Postgres

#35
post #31

Caching is mentioned in the article: What do you guys feel about using PostgreSQL for caching instead of Redis? Redis is many times faster, so much that it doesn't seem comparable to me. A lot of data you can get away with just caching in-mem on each node, but when you have many nodes there are valid cases where you really want that distributed cache.

Prove that you need the extra speed. Run benchmarks that show that, for your application under your expected best-case loads, using Redis for caching instead of PostgreSQL provides a meaningful improvement. If it doesn't provide a meaningful improvement, stick with PostgreSQL.

This is the proper approach when deciding whether to use any type of tool or technology. Is the increased amount of cognitive overhead for someone with minimal exposure to your system (who will have to maintain it when you’ve moved on) worth the increased performance on a dollars-per-hour basis? If so, it may be a good option. If not, it doesn’t matter how much better the relative performance is.

Re: It's 2026, Just Use Postgres

#37
post #4

The point of Redis is data structures and algorithmic complexity of operations. If you use Redis well, you can't replace it with PostgreSQL. But I bet you can't replace memcached either for serious use cases.

“well” is doing a lot of heavy lifting in your comment. Across a number of companies using Redis, I’ve never seen it used correctly. Adding it to the tech stack is always justified with hand waving about scalability.

Re: It's 2026, Just Use Postgres

#38

Caching is mentioned in the article: What do you guys feel about using PostgreSQL for caching instead of Redis? Redis is many times faster, so much that it doesn't seem comparable to me. A lot of data you can get away with just caching in-mem on each node, but when you have many nodes there are valid cases where you really want that distributed cache.

Depends on your app cache needs. If it's moderate, I'd start with postgres...ie. not have operate another piece of infra and the extra code. If you are doing the shared-nothing app server approach (rails, django) where the app server remembers nothing after each request Redis can be a handy choice. I often go with having a fat long lived server process (jvm) where it also acts for my live caching needs. #tradeoffs

Re: It's 2026, Just Use Postgres

#40
Something TFA doesn’t mention, but which I think is actually the most important distinction of all to be making here:

If you follow this advice naively, you might try to implement two or more of these other-kind-of-DB simulacra data models within the same Postgres instance.

And it’ll work, at first. Might even stay working if only one of the workloads ends up growing to a nontrivial size.

But at scale, these different-model workloads will likely contend with one-another, starving one-another of memory or disk-cache pages; or you’ll see an “always some little thing happening” workload causing a sibling “big once-in-a-while” workload to never be able to acquire table/index locks to do its job (or vice versa — the big workloads stalling the hot workloads); etc.

And even worse, you’ll be stuck when it comes to fixing this with instance-level tuning. You can only truly tune a given Postgres instance to behave well for one type-of-[scaled-]workload at a time. One workload-type might use fewer DB connections and depend for efficiency on them having a higher `work_mem` and `max_parallel_workers` each; while another workload-type might use many thousands of short-lived connections and depend on them having small `work_mem` so they’ll all fit.

But! The conclusion you should draw from being in this situation shouldn’t be “oh, so Postgres can’t handle these types of workloads.”

No; Postgres can handle each of these workloads just fine. It’s rather that your single monolithic do-everything Postgres instance, maybe won’t be able to handle this heterogeneous mix of workloads with very different resource and tuning requirements.

But that just means that you need more Postgres.

I.e., rather than adding a different type-of-component to your stack, you can just add another Postgres instance, tuned specifically to do that type of work.

Why do that, rather than adding a component explicitly for caching/key-values/documents/search/graphs/vectors/whatever?

Well, for all the reasons TFA outlines. This “Postgres tuned for X” instance will still be Postgres, and so you’ll still get all the advantages of being able to rely on a single query language, a single set of client libraries and tooling, a single coherent backup strategy, etc.

Where TFA’s “just use Postgres” in the sense of reusing your Postgres instance only scales if your DB is doing a bare minimum of that type of work, interpreting “just use Postgres” in the sense of adding a purpose-defined Postgres instance to your stack will scale nigh-on indefinitely. (To the point that, if you ever do end up needing what a purpose-built-for-that-workload datastore can give you, you’ll likely be swapping it out for an entire purpose-defined PG cluster by that point. And the effort will mostly serve the purpose of OpEx savings, rather than getting you anything cool.)

And, as a (really big) bonus of this approach, you only need to split PG this way where it matters, i.e. in production, at scale, at the point that the new workload-type is starting to cause problems/conflicts. Which means that, if you make your codebase(s) blind to where exactly these workloads live (e.g. by making them into separate DB connection pools configured by separate env-vars), then:

- in dev (and in CI, staging, etc), everything can default to happening on the one local PG instance. Which means bootstrapping a dev-env is just `brew install postgres`.

- and in prod, you don’t need to pre-build with new components just to serve your new need. No new Redis instance VM just to serve your so-far-tiny KV-storage needs. You start with your new workload-type sharing your “miscellaneous business layer” PG instance; and then, if and when it becomes a problem, you migrate it out.

Post reply on HN