Re: Help with pre-loaded arbitrary key sequences

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help with pre-loaded arbitrary key sequences
Date: 2008-01-17 15:15:38
Message-ID: dcc563d10801170715p7c6cd451of0710a13131fefaa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jan 17, 2008 9:05 AM, James B. Byrne <byrnejb(at)harte-lyne(dot)ca> wrote:
>
> If the entries involved numbered in the millions then Scott's approach has
> considerable merit. In my case, as the rate of additions is very low and
> the size of the existing blocks is in the hundreds rather than hundreds of
> thousands then I believe that I will simply write my own iterator and do a
> repetitive select when on the incrementally proposed values until an
> opening is found then insert the new entry and update the iterator next
> value accordingly.

If race conditions are a possible issue, you use a sequence and
increment that until you get a number that isn't used. That way two
clients connecting at the same time can get different, available
numbers.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message James B. Byrne 2008-01-17 15:19:21 Re: Help with pre-loaded arbitrary key sequences
Previous Message Peter Bauer 2008-01-17 15:08:33 Don't cascade drop to view