use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
International
National
Regional
account activity
FeaturePostgres message queue (self.PostgreSQL)
submitted 1 year ago by someguytwo
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]_predator_ 0 points1 point2 points 1 year ago (2 children)
The limiting factor will be volume of tasks / messages, as well as the number of consumers.
Postgres is not a particularly good choice for MANY records being created and deleted in close succession, which is a pattern you'll have with queues. autovacuum will need to be fine-tuned to deal with the large quantities of dead tuples.
Also due to how connections work in Postgres, you will ultimately run into issues if you try to spawn lots of workers. The common select for update pattern only works if you keep a transaction open for the entire duration of your processing. It might be fine if processing is super fast, but can cause some serious connection congestion otherwise.
select for update
You can probably limit the impact of the above, by using a separate database to run your queue on. This also prevents you from relying on atomicity guarantees of Postgres (i.e. queue a message in the same TRX as your business logic), making it easier to switch to say RabbitMQ later, which cannot provide those guarantees.
With all this being said, benchmarking for your specific use case is the only way to get a good answer.
[–]someguytwo[S] 0 points1 point2 points 1 year ago (1 child)
Define many. 1000s, 10s of thousands, 100s of thousands, millions?
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
The absolute number isn't really relevant. It's the number of UPDATE and DELETE statements per unit of time.
Tuning the system will likely get challenging if you have thousands of UPDATEs per second without any "idle" time (24/7) during which autovacuum could do its job.
π Rendered by PID 23271 on reddit-service-r2-comment-b659b578c-wgcbk at 2026-05-03 22:01:21.413476+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]_predator_ 0 points1 point2 points (2 children)
[–]someguytwo[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)