Top
Best
New

Posted by b-man 2 hours ago

Do you need separate systems when you already have Postgres?(postgresisenough.dev)
96 points | 68 comments
dpc10 1 hour ago|
I love Postgres, and I agree with the general sentiment. But I read the (growing) genre of "use Postgres for everything" articles and they imply a difficulty in running other software that I just don't see.

I'm thinking of Redis in particular. If you're using it as incredibly fast but not critical storage, it's trivial to set up and it ~never crashes or requires maintenance. It creates no headaches, and in exchange gives me a k/v store that I can thrash without worrying about performance (I know it's fast), downstream impact (am I slowing down critical-path SQL queries), etc. Especially in the age of LLMs, which I've found to be great at devops-type tasks, I feel slightly less compelled to simplify my stack.

gentlewater 21 minutes ago||
Only problem for me vs using your primary DB is that Redis has no redundancy unless you run it in cluster mode. For us that means when the kubernetes node restarts, availability degrades. Could of course enable clustering, but at that point it isn’t dead simple anymore. And using the DB is.
preisschild 20 seconds ago||
If you run kubernetes, it might be worth looking at valkey/valkey-operator that manages a valkey cluster for you.
alex_smart 22 minutes ago|||
The problem only arises when you have to worry about persistent state. As soon as you have to worry about that, you have to think about backups, replicas, disaster recovery drills and so on. It is much easier to solve for that can of worms for one system than three.
dinkleberg 1 hour ago|||
Yeah I've found this quite odd. Even the LLMs want to pressure you to not use Redis and go all in on Postgres. Postgres is great, and I usually use it. But Redis is so trivial to add to your stack and it does what it does really well. Why not use the right tool for the job?
c0_0p_ 13 minutes ago|||
Presumably this is because LLMs just echo all the pro-Postgres Medium articles they've been trained on. They don't have any actual experience.
happyPersonR 37 minutes ago||||
LLMs from hyperscalers allow for paid advertising
Faaak 1 hour ago|||
because if you already have postgres, and dont need thousands of k/v per second, then postgres can do the same ?
stickfigure 1 hour ago||
If you're stressing your database, offloading some work to Redis can buy you a lot of Postgres headroom. But sure, start with YAGNI.
Xeoncross 1 hour ago|||
Redis really is a great piece of software. Low memory, high-performance, feature-rich, and stable. Really hard to beat it for places where you want a durable cache even if technically you can use something else.
deepsun 1 hour ago|||
And Redis has auto-delete rows (aka TTL). In Postgres you need a cron job to clear stale rows.
pooloo 50 minutes ago||
This is one way to handle the problem, but not the only...
stavros 1 hour ago||
Oh no, redis is super simple to set up and use. It's just that setting it up is not as simple as not setting it up.
tracker1 1 hour ago|||
For smaller projects and locally, I'm running background services via a compose file... it's a few lines of configuration, and just works. Redis is crazy low hanging fruit.. even job queues that run over Redis make a bit more sense than with Postgres more often than not.

I'm far more hesitant to throw a more formal MQ in the mix though... mostly from experience in that a lot of mid level ("senior") developers don't really understand queues very well at all. Even if conceptually, using tables for queues is more complex.

That said, I will use PG for workflows similar to K/V, Document (JSONB) and other structures over reaching for say MongoDB, etc.

willsmith72 21 minutes ago||
Of course spinning up a hello world of anything is easy. Now introduce monitoring, change controls, version upgrades, multiple environments and regions

It's not that it's necessarily complex. But if you don't need it, don't use it. The business could use your time elsewhere

tracker1 14 minutes ago||
For a redis cache? I think you're way over-valuing the effort it takes to keep a redis instance running.

For a persistent store.. sure... but that's true for PostgreSQL as well, which has some pretty painful major version migrations by comparison to other options.

wuliwong 1 hour ago|||
OK, but it is relatively easy to setup. Obviously, nobody thinks it is _literally_ effortless.
munk-a 1 hour ago||
Every extra straw you put on the back of your ops team, especially when you're a young company, adds weight. It's good to be choosey about which technologies actually justify that expenditure.
wuliwong 48 minutes ago||
Your response is a Strawman argument. I was simply saying that nobody thinks that Redis is literally effortless. I was pointing out that the person's comment was not helpful as they were pointing out that Redis installation does actually require effort.

A better response to my comment could have been "just let it go" or something. ₍₍(˶>ᗜ<˶)⁾⁾

CodesInChaos 1 hour ago||
I'd love the ability to mark a table as "read committed" to prevent long running transactions from keeping old versions of a tuple alive, or even "read uncommitted" to enable in-place updates. Or perhaps instead of downgrading isolation, those serializable/snapshot transactions could simply fail when reading a value from such a table that was modified after they started.

An example of a table that would benefit from this would be rate-limits / concurrency-limits, which are commonly implemented using Redis instead of Postgres.

xnorswap 1 hour ago|
Surely the last place you'd want to use those weaker consistency guarantees is a concurrency limiter?
CodesInChaos 58 minutes ago||
The limiter itself should be able to ensure consistency via pessimistic row level locking, even at lower isolation levels.

What I don't want is long running unrelated transactions keeping old tuples alive just it case they're needed. My third suggestion where transactions attempting to read old versions fail is probably better than the first two where isolation gets silently downgraded, since it avoid that problem.

ComputerGuru 1 hour ago||
I am very much in camp “minimize your dependencies and take the utmost advantage of what you already have” but I also am in camp “your database is the most important bottleneck component.”

This has two implications:

1) make sure if you use Postgres for anything beyond core rdbms functionality that there is no dependency between the two, so you can rip out the additional functionality and move to a different platform when you end up needing to reduce the load on your db server

2) if using Postgres for non-essentials complicates your db backup workflow, risks the data integrity, makes it difficult to maintain or upgrade your Postgres instance (eg you have to wait months or years for compatibility with newer Postgres versions), or loads relatively shoddy or unstable code into the beating heart of your application, then you should either use a different Postgres server/install/container for these ancillary services or bite the bullet and introduce an alternative dependency, depending on which makes more sense.

tudorg 23 minutes ago||
As small piece of feedback, I think it would be really good if the tools list would include license information, and make it easy to filter for open source tools/licenses. IMHO source-available extensions break part of what is attractive to the Postgres ecosystem, which is that you can move from one provider to another without vendor lock-in.
JsonDemWitOster 1 hour ago||
I'll do you one better: do you really need Postgres and all these extensions when you already have a filesystem?

> only after pushing Postgres to its limits, documenting why it was insufficient, and accepting the operational cost of the alternative

I love Postgres as a DB but, really, this is ridiculous. No doubt these extensions can do the job well-enough but you might as well invest in learning the right tool for the problem from the start, when the stakes are still pretty low. Why wait until, ahem, Postgres is pushed to the limit before you spin up a Redis cluster?

You don't get free opcost by using Postgres for everything. Arguably if you end up with a monolith of a database, you are paying a higher opcost (imagine if too much caching can affect all CRUD ops in your platform). Or you can manage a cluster of PG instances but that's no less complex---each plugin still comes with its own opcost!

No Silver Bullet, No Free Lunch, and all that. If your problem domain really warrants something outside of relational storage, you're gonna pay that complexity cost one way or another. You can't escape it by shoehorning everything in Postgres, fantastic as a DB as it is.

buremba 14 minutes ago||
Filesystem is best when there is a single writer and many readers.

If you have bunch of files and don't have any structure, yes filesystem is great but the moment when you need consistency & performance (which you need sooner rather than later) use databases.

Investing early doesn't hurt when you build a product that you know will have many writers.

pooloo 58 minutes ago|||
I don't understand why the answer is to always bloat the system with more specialized software and technical debt, instead of optimizing the existing system. If Postgres can truly handle all of these situations, then mastery of that one tool should be focused on.

I guess its more the rapid start-up mindset to get it up and running fast to sell the company, and leave the problem for someone else which is why a lot of our world is falling apart...

whstl 46 minutes ago||
Yeah. I feel it's more of a "ticking all the boxes" situation than anything.

For example: I worked with Rails from 2009-2024 and I haven't come across a single Rails project in the wild that didn't have the queue du jour installed: sideqik+redis, delayed-job before, etc. And then since it's there, people just end up using.

PaulHoule 1 hour ago|||
Filesystems aren't efficient for small bits of data.

Like right now I am thinking about a system that has a password reset process and you need to keep track of a user id and a reset token, one or two timestamps, maybe a state variable and a flag or two. That's well under 100 bytes and the cluster size for a typical fs is 4kb or more plus there is the cost of the directory entry. If the OS is Windows it has to ask the Security Manager when ever you open it or delete it which is even more heavyweight.

It's common now for applications that handle lots of little "files" to store them as blobs in SQLlite! See https://sqlite.org/fasterthanfs.html

scuff3d 18 minutes ago|||
In my experience the real answer is almost always "just don't do that other stuff". Most of the complexity Postgress is claiming to fix here doesn't need to exist in the first place.
Onavo 1 hour ago||
Do filesystems offer ACID guarantees though? Depending on the use case, something like sqlite might work better (or write to a CAS system like S3).
wuliwong 1 hour ago||
For context, I am mainly talking about my personal projects, ideas I am trying out, MVPs/prototypes for potential new businesses, etc.

I have started just using Postgres to back queues. It is simpler (although I have spun up new apps with Redis so many times it is only a small improvement) but more importantly it is cheaper. I really do try a lot of stuff out, so completely removing a infrastructure piece is a nice money saver. Again, not massive but it's cheaper.

The downsides of doing this in the prototype/MVP context are minimal. At the scale of prototype and MVPs, I certainly don't see any difference in performance.

I did note in the graphic it listed Kafka but in the lower table graphic I did not see any Postgres replacement for Kafka. If I am at the scale where I really want Kafka, it is probably for performance and I just can't believe there's anyway Postgres could provide that.

So, I love the flexibility and all-in-one abilities of Postgres for prototyping and making MVPs. But at my job, nobody is proposing exclusively using Postgres for persistence.

armdave 53 minutes ago||
Articles like these have been insanely effective in biasing LLMs (especially OpenAI) toward Postgres. There areas where Postgres beats MySQL, and vice versa - but ChatGPT/Codex overwhelmingly recommend "default to Postgres."
c0_0p_ 10 minutes ago|
I agree, the inevitable feedback loops will be painful to watch play out. AI written blog -> AI training set -> repeat.
stickfigure 53 minutes ago||
Fun fact for people whose scaling plan anticipates moving from Postgres to CRDB:

SELECT FOR UPDATE SKIP LOCKED works great for turning Postgres into a job queue. It does not work the same way on CRDB and you will likely have to rewrite those queries or use an external job queue.

bitbasher 1 hour ago||
I was on the Postgres train for 10+ years. Then I fell in love with Sqlite and have been using it for everything.
pavel_lishin 2 hours ago|
Are the various plugins easier to set up, configure, troubleshoot, etc. than the other software options? If I'm paged awake at 2am, will I have an easier time figuring out pgmq than I will RabbitMQ?
nhumrich 1 hour ago||
For these specifically? Way easier than rabbitMQ. I love rabbitmq. It's an amazing technology, and if you need a high throughout message bus, it's still a better goto. But.. it does require quite a lot of expertise and know how to operate. Paged at 2am, you will likely get very frustrated. Pgmq though, is "just a bunch of tables". It's going to be a lot easier to figure out what's going on. You already understand transactional DBs.

Unless of course, you already know how to operate rabbitmq.

AnatolySkuba 32 minutes ago||
[flagged]
More comments...