Re: Small PosgreSQL locking function request - with bounty - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Small PosgreSQL locking function request - with bounty
Date
Msg-id 1379172586.30975.YahooMailNeo@web162901.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: Small PosgreSQL locking function request - with bounty  (David Noel <david.i.noel@gmail.com>)
List pgsql-general
David Noel <david.i.noel@gmail.com> wrote:

> I've read through the documentation, found a few examples using
> "for update" syntax, and it looks like you're right. Would
> transaction level SERIALIZABLE also work? It does seem messier
> though, having to handle errors thrown due to concurrent
> transactions.

The SERIALIZABLE transaction isolation level, as implemented in
PostgreSQL, would provide correct behavior; but is not a very
efficient way to handling access to the ends of a queue.
Regardless of the isolation level you use for other things, you
probably want blocking around access to the ends of the queue -- or
at least to the part where you pull an item from the queue for
processing.  The tricky part is likely to be making sure that if
something is pulled from the queue it gets processed or gets put
back onto the queue.  Without careful planning you might risk
either losing items or blocking not just for pulling off the queue,
but all the way through processing.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-general by date:

Previous
From: CS DBA
Date:
Subject: Re: How to switch file systems with least downtime?
Next
From: Kevin Grittner
Date:
Subject: Re: Postgres 9.2.4 "Double Precision" Precision