Re: Best approach for a "gap-less" sequence - Mailing list pgsql-general

From Jorge Godoy
Subject Re: Best approach for a "gap-less" sequence
Date
Msg-id 87wt9ctyms.fsf@ieee.org
Whole thread Raw
In response to Re: Best approach for a "gap-less" sequence  (Christian Kratzer <ck-lists@cksoft.de>)
Responses Re: Best approach for a "gap-less" sequence  (Christian Kratzer <ck-lists@cksoft.de>)
List pgsql-general
Christian Kratzer <ck-lists@cksoft.de> writes:

> I would at least try to assign multiple such numbers in batches to mimize
> contention on the row you store the counter in.

What do you mean here?  How would you guarantee that on of the receiver
transactions didn't rollback and left a gap in the "sequence"?

I believe that for invoices it is less problematic.  At least here I don't
need the "time" part control, so if I leave one blank I can fill it later in
the same day without problems (except, of course, if the sequence number is
tied to some other physical evidence such as the paper counterpart of the
invoice and that is also chronologically assigned).

The whole problem appears because no matter how much we validate input and
relationships on the input interface, something might happen and make the
"INSERT" transaction fail.  Theoretically, all should go fine, but... :-)

--
Jorge Godoy      <jgodoy@gmail.com>


pgsql-general by date:

Previous
From: Christian Kratzer
Date:
Subject: Re: Best approach for a "gap-less" sequence
Next
From: Bruce Momjian
Date:
Subject: Re: Connection string