3 ms·
I wrote our own little Go and Postgres job queue similar in spirit. Some tricks we used: - Use FOR NO KEY UPDATE instead of FOR UPDATE so you don't block inser
by sa46 3y ago
I wrote our own little Go and Postgres job queue similar in spirit. Some tricks we used:
- Use FOR NO KEY UPDATE instead of FOR UPDATE so you don't block inserts into tables with a foreign key relationship with the job table. [1]
- We parallelize worker by tenant_id but process a single tenant sequentially. I didn't see anything in the docs about that use case; might be worth some design time.
[1]: https://www.migops.com/blog/select-for-update-and-its-behavior-with-foreign-keys-in-postgresql/ https://www.migops.com/blog/select-for-update-and-its-behavi...