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

From Alvaro Herrera
Subject Re: pg_advisory_lock(bigint) vs. LOCK TABLE
Date
Msg-id 20080718183015.GH4042@alvh.no-ip.org
Whole thread Raw
In response to Re: pg_advisory_lock(bigint) vs. LOCK TABLE  (Mark Roberts <mailing_lists@pandapocket.com>)
List pgsql-sql
Mark Roberts wrote:
> 
> On Thu, 2008-07-17 at 12:16 -0400, Alvaro Herrera wrote:
> > Volkan YAZICI wrote:
> > > Hi,
> > > 
> > > What's the difference between below two queue implementations?
> > 
> > They are two different lock spaces.  pg_advisory_lock does not conflict
> > with regular system locks, whereas LOCK TABLE does.
> 
> It also appears that advisory locks are tied to your session, where
> system locks are tied to your transaction.

Now that you mention that, I recall that the other important difference
is that you can release pg_advisory_lock anytime you want.  With LOCK
TABLE it always happens automatically at transaction commit (and there's
no UNLOCK TABLE).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-sql by date:

Previous
From: Mark Roberts
Date:
Subject: Re: pg_advisory_lock(bigint) vs. LOCK TABLE
Next
From: Karl Denninger
Date:
Subject: Whassup with this? (create table .... like ... fails)