On Thu, January 17, 2008 11:48, Scott Marlowe wrote:
> Got bored, hacked this aggregious pl/pgsql routine up. It looks
> horrible, but I wanted it to be able to use indexes. Seems to work.
> Test has ~750k rows and returns in it and returns a new id in < 1ms
> on my little server.
>
> File att
On Jan 17, 2008 9:19 AM, James B. Byrne <[EMAIL PROTECTED]> wrote:
>
> On Thu, January 17, 2008 10:15, Scott Marlowe wrote:
> >
> > 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
On Jan 17, 2008 9:19 AM, James B. Byrne <[EMAIL PROTECTED]> wrote:
>
> On Thu, January 17, 2008 10:15, Scott Marlowe wrote:
> >
> > 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
On Thu, January 17, 2008 10:15, Scott Marlowe wrote:
>
> 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.
>
That is close to the idea
On Jan 17, 2008 9:05 AM, James B. Byrne <[EMAIL PROTECTED]> 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
On Wed, January 16, 2008 18:40, Scott Marlowe wrote:
> You're essentially wanting to fill in the blanks here. If you need
> good performance, then what you'll need to do is to preallocate all
> the numbers that haven't been assigned somewhere. So, we make a table
> something like:
>
> create tab
On Jan 11, 2008 10:43 AM, James B. Byrne <[EMAIL PROTECTED]> wrote:
> I am prototyping a system migration that is to employ Ruby, Rails and
> PostgreSQL. Rails has the convention that the primary key of a row is an
> arbitrary integer value assigned by the database manager through a
> sequence. A
On Fri, Jan 11, 2008 at 11:43:54AM -0500, James B. Byrne wrote:
> My question is this: Can one assign an id number to a sequenced key column
> on create and override the sequencer? If one does this then can and, if
> so, how does the sequencer in Postgresql handle the eventuality of running
> into
I am prototyping a system migration that is to employ Ruby, Rails and
PostgreSQL. Rails has the convention that the primary key of a row is an
arbitrary integer value assigned by the database manager through a
sequence. As it turns out, the legacy application employs essentially the
same conventi