Re: guaranteeing that a sequence never skips (fwd)

From: Mike Nolan <nolan(at)gw(dot)tssi(dot)com>
To: cbbrowne(at)acm(dot)org (Christopher Browne)
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: guaranteeing that a sequence never skips (fwd)
Date: 2004-10-03 20:23:17
Message-ID: 200410032023.i93KNHGO022319@gw.tssi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Then, every once in a while, a separate process would go in, see the
> highest value on idfield < 250M, and rewrite the idfield on all of the
> tuples where idfield > 250M. It would be efficient due to the partial
> index. It limits the number of documents to 250M, but I'm sure that
> can be alleviated when it turns into an issue...

I think you'd be better off using two columns. Call the first one the
'work ticket' for the check request, and you don't really care if it has gaps
in it or not, its primary purpose is to ensure that each check request
has a unique document number of some kind, so a sequence works fine.

One and only one program assigns the actual check numbers--in a separate
column.

That's the sort of thing that most commercial packages do, even though it
seems clumsy and adds an extra step, and that's why they do it that way, too.
--
Mike Nolan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gaetano Mendola 2004-10-04 01:01:39 Re: VACUUM FULL on 24/7 server
Previous Message Scott Ribe 2004-10-03 20:10:57 Re: Out of memory errors on OS X