Transactions and insertion ordering

From: James Pharaoh <james(at)pharaohsystems(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Transactions and insertion ordering
Date: 2004-06-10 08:28:50
Message-ID: 1086856130.6365.4.camel@styx.phsys.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm trying to work out how to make sure things are read from a table in
a consistent order. The table represents a queue of items and also the
history of those items.

Even with "serializable" transaction isolation I can begin two
transactions, insert a record in each, commit the second transaction
first. This second record is now visible and can be read from the queue.
But when I commit the first this one appears before the second one. This
could then be read from the queue second but when I rescan the table to
view history it looks like it was read first.

Are there any ways to make this work a little more intuitively?
Basically I guess I want to be able to model a queue effectively.

James

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-06-10 08:32:44 Re: How to tell when postmaster is ready
Previous Message Holger Klawitter 2004-06-10 08:18:12 Re: How to tell when postmaster is ready