Re: Transactions and insertion ordering

From: James Pharaoh <james(at)pharaohsystems(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Transactions and insertion ordering
Date: 2004-06-10 14:05:56
Message-ID: 1086876356.2285.104.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2004-06-10 at 14:47, Bruno Wolff III wrote:
> I think the real problem is that the original poster needs to precisely
> define what determines order. If the precise definition is transaction
> commit order, I think that is going to be hard to do exactly right.

Yes, that is what I want. So I can guarantee that the order of the IDs
in the database will be the same as the order in which they are taken
out of the queue.

I think I've come up with a reasonable solution now though. I can lock
the record representing the queue in another table FOR UPDATE and then
do the insert, then no other process will be able to gain that lock
until I complete. Best bit is other items can still insert concurrently,
but only one per queue, which is exactly what I was after.

Thanks for the help anyway ;-)

James

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2004-06-10 14:16:12 Re: Record order change after update
Previous Message Franco Bruno Borghesi 2004-06-10 13:49:34 Re: Record order change after update