1. TRUNCATE if cleanup is needed (no DELETEs) + partitioning.
2. SELECT .. FOR UPDATE SKIP LOCKED or advisory locks.
It's worth learning from Skype's PgQ developed in 2000-s.
Update: found the work with advisory locks in the code, great.
1. TRUNCATE if cleanup is needed (no DELETEs) + partitioning.
2. SELECT .. FOR UPDATE SKIP LOCKED or advisory locks.
It's worth learning from Skype's PgQ developed in 2000-s.
Update: found the work with advisory locks in the code, great.