pg_advisory_lock(bigint) vs. LOCK TABLE - Mailing list pgsql-sql

From Volkan YAZICI
Subject pg_advisory_lock(bigint) vs. LOCK TABLE
Date
Msg-id 87sku9wph7.fsf@alamut.mobiliz.com.tr
Whole thread Raw
Responses Re: pg_advisory_lock(bigint) vs. LOCK TABLE
List pgsql-sql
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/


pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: Problem with ORDER BY and DISTINCT ON
Next
From: Milan Oparnica
Date:
Subject: Re: PERSISTANT PREPARE (another point of view)