Ways to shoot yourself in the foot with Postgres
281–290 of 329 posts
Re: Ways to shoot yourself in the foot with Postgres
#282Re: Ways to shoot yourself in the foot with Postgres
#283Re: Ways to shoot yourself in the foot with Postgres
#284> Setting acquired_at on read guarantees that each event is handled only once. After they've been handled, you can then delete the acquired events in batches too (there are better options than Postgres for permanently storing historical event data of unbounded size). This bothers me. It's technically true, but ignores a lot of nuance/complexity around real-world event processing needs. This approach means you will ne…
Yep, a few people have mentioned this to me here and on Reddit. I didn't know about the issues with the approach I proposed, so was pleased to read the comments. Will add a correction to the post as soon as I have a sec, thanks.
Re: Ways to shoot yourself in the foot with Postgres
#285> With that in place you could acquire events from the queue like so: UPDATE event_queue SET acquired_at = now() WHERE id IN ( SELECT id FROM event_queue WHERE acquired_at IS NULL ORDER BY occurred_at LIMIT 1000 -- Set this limit according to your usage ) RETURNING *; Would you need a FOR UPDATE in that subquery?