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