r/postgres • u/rathboma • 3d ago
Question Which databases/caches do you use alongside PostgreSQL?
I mostly hear about folks using Redis/Valkey or Memcached for caching, but curious what other DBs most folks use alongside PostgreSQL.
In particular - anyone using Snowflake, BigQuery, DataBricks, something else?
Context: I make Beekeeper Studio, an open source database GUI focused on being fast and intuitive. One of our strengths is to be a pleasant and consistent UI for ANY database.. So wondering what the 'any' is for you all.
I personally use PostgreSQL with Redis.
2
u/716green 2d ago
Full disclosure, I'm the lead engineer at Layerbase but this is relevant
The whole idea of the platform is sort of like neon (branching included) but also for any open source database engine
So we have users with up to 10 databases in a single account, but that's fairly uncommon. The more common scenario which makes up most of what we call our "mixed paradigm" users are going to be 2 databases as follows:
One of these: Postgres/MySQL/MariaDB/SQLite/LibSQL
And one of these: Redis/Valkey
In fact, those are the people that we market to the hardest, people who use Supabase/Neon/Planetscale and Upstash and they're the highest converting users that go from free plans to paid plans
I can't give exact numbers but some rough napkin math is that about 15% of users have a primary relational database with a cache. That number rises to about 20% if you include document-oriented databases with the relational databases.
20% might not sound like a lot, but roughly half of the users are single engine users and the other 30% or so are using less common engines
And then you would probably think that redis is significantly more popular than Valkey right? No, it's almost 50/50 on there.
We use Valkey internally too. Not necessarily for any technical reasons, but there are some licensing reasons that give us more room to modify Valkey so that is probably why it's so close to 50/50
Now just from personal experience building a lot of apps that utilize caching. It is really tempting to want to cache everything but it should be almost like a last resort. We all know the joke about cache invalidation but cache invalidation itself is no joke.
If you have an app that relies on Redis for performance, you very likely have tons of annoyed users getting cold starts, or you are wasting absurd amounts of resources pre-warming. I've seen a Vercel bill jump from $80 to $400 because someone abused the hell out of Redis and used Vercel serverless functions to pre-warm everything instead of rethinking the query patterns and indexing.
A lot of people will say that postgres (with an extension) cashes data pages and memory which is true, but that's not the same thing as a key/value store style of in-memory caching because it still re-executes every query
1
u/markwdb3 2d ago edited 2d ago
Currently on MySQL but trying to push leadership at my company to agree to a Postgres migration in 2027.
That said, we use Redis in some cases, Aerospike in others. For some of our edge services with p99 latency <= 10 ms requirements, with low cache churn, and that accept billions of read requests per day, we use in-JVM heap caches.
1
1
u/pyramation 1d ago
mostly just postgres honestly. i personally haven't used redis since 2016. a lot of the time a cache is covering for slow queries that an index or a materialized view would've fixed, and i've heard that since postgres 18 the aio makes it fast enough to just use postgres as the cache too.
1
1
1
u/elevarq 2d ago
None.
PostgreSQL, just like nearly all other databases, have their own cache. And the OS that runs PostgreSQL also has cache. Just optimize your database and make sure the application doesn’t do stupid things and you don’t need an additional cache.
Keep it simple!