Hacker News new | ask | show | jobs
by nitred 1602 days ago
This is easily a few thousand dollars worth of advice. I use PostgreSQL regularly but I would never have been able to come up with this solution myself.

Having queues on Postgres is going to be such a great addition to my tool belt especially since there's always a Postgres instance running somewhere anyway.

I know the first use case that jumps to mind is a job queues, but I feel like the method described in the article is quite low level which means it can be used as a base to solve many use cases.

* I won't have to reach for Kafka/Redpanda unless the rate of events/messages reaches 100k-1000k per day.

* I can add one column called queue_id where each unique queue_id refers to a new queue which means I can use a single table for multiple queues.

* If I add a new column called event_type, then I wonder if it's possible to create a composite event queue, where for example the query must return exactly two rows and one row must have event_type=type_1 and second row must have event_type=type_2 and both rows are locked and processed exactly once?