Hi,
What's the difference between below two queue implementations?
-- -- With advisory locks. -- BEGIN; SELECT pg_advisory_lock((SELECT oid FROM pg_class
WHERE relname = 'queue')); DELETE FROM queue WHERE id = (SELECT MIN(id) FROM queue)
RETURNINGid, val; SELECT pg_advisory_unlock((SELECT oid FROM pg_class
WHERE relname = 'queue')); COMMIT; -- -- With LOCK table command. -- BEGIN; LOCK TABLE queue; DELETE FROM queue
WHERE id = (SELECT MIN(id) FROM queue) RETURNING id, val; COMMIT;
Any helps will be appreciated. (BTW, yep, I'm aware of PGQ module of
skyytools[1].)
Regards.
[1] http://skytools.projects.postgresql.org/