Re: JDBC problem

From: Cedar Cox <cedarc(at)visionforisrael(dot)com>
To: John McKown <jmckown(at)prodigy(dot)net>
Cc: BogdanKRomski <b(dot)kromski(at)gaschka(dot)pl>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: JDBC problem
Date: 2000-08-27 06:04:15
Message-ID: Pine.LNX.4.21.0008270849150.19334-100000@nanu.visionforisrael.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Fri, 25 Aug 2000, John McKown wrote:

[talking about sequences]

> > Question: What happens when transactions enter the picture? Will you get
> > duplicate values, or holes, or does it work just fine?
>
> A good question to which I don't know the answer.
>
> However, after thinking about it a bit, I would guess that the sequence is
> "locked" for the duration of the transaction. This would imply that all
> other transactions which needed to access the sequence would be stalled
> until this transaction ended. When the transaction ended, then sequence
> would either have the highest number assigned so far, or would be rolled
> back to the same value it had when the transaction started.
>
> The above is just my guess. If the sequence is not "locked", then I would
> guess that an aborted transaction would cause the sequence to end up with
> holes. Actually, multiple tables and fields can share a sequence (why
> would anybody do this?).

I'm not sure either, but I'm sure it could be used for something
interesting..

> This means that a single table could have "holes" in the sequence.
>
> Under no circumstances would I expect duplicates.

This 'locking' thing was what I was wondering about. If 'sequence
locking' does actually take place, I don't like the idea of other
transactions having to wait but it seems necessary. On the other hand,
holes in a sequence shouldn't be an issue for us so 'no locking' would be
just fine. Can someone confirm? I just want to make sure I have a
correct understanding of how it works..

Thanks
-Cedar

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Joachim Achtzehnter 2000-08-27 18:36:29 Re: JDBC problem
Previous Message Peter Mount 2000-08-26 09:56:16 Re: JDBC + large objects problem