logoalt Hacker News

reactordevyesterday at 5:32 PM6 repliesview on HN

Another day, another “Using PostgreSQL for…” thing it wasn’t designed for. This isn’t a good idea. What happens when the queue goes down and all messages are dead lettered? What happens when you end up with competing messages? This is not the way.


Replies

direwolf20yesterday at 6:44 PM

The other system you're using that isn't Postgres can also go down.

Many developers overcomplicate systems. In the pursuit of 100% uptime, if you're not extremely careful, you removed more 9s with complexity than you added with redundancy. And although hyperscalers pride themselves on their uptime (Amazon even achieved three nines last year!) in reality most customers of most businesses are fine if your system is down for ten minutes a month. It's not ideal and you should probably fix that, but it's not catastrophic either.

show 2 replies
fcarraldoyesterday at 6:21 PM

There are a ton of job/queue systems out there that are based on SQL DBs. GoodJob and SupaBase Queues are two examples.

It’s not usable for high scale processing but most applications just need a simple queue with low depth and low complexity. If you’re already managing PSQL and don’t want to add more management to your stack (and managed services aren’t an option), this pattern works just fine. Go back 10-15yrs and it was more common, especially in Ruby shops, as teams willing to adopt Kafka/Cassandra/etc were more rare.

show 1 reply
hnguyen14yesterday at 6:05 PM

How so? There are queues that use SQL (or no-SQL) databases as the persistence layer. Your question is more specific to the implementation, not the database as persistence layer itself. And there are ways to address it.

senbrowyesterday at 6:11 PM

Criticism without a better solution is only so valuable.

How would you do this instead, and why?

show 1 reply
trympetyesterday at 8:57 PM

I prefer using MS Exchange mailboxes for my message queue.

odie5533yesterday at 5:48 PM

You wouldn't ack the message if you're not up to process it.