Re: BUG #6258: Lock Sequence

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Laerson keler <laerson(dot)keler(at)lkmc(dot)com(dot)br>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6258: Lock Sequence
Date: 2011-10-17 20:55:11
Message-ID: CAJKUy5jHxRa7hYZFSgk-+oVGLdtsh5JcG1HuPU_WPTP_QmCqAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 17, 2011 at 2:43 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> There really is not any way to generate guaranteed-hole-free sequences
> using sequence objects.  If you have to have that, I'd suggest locking
> the table against other writes and then fetching MAX(id) + 1.  It's not
> very fast, and it's not at all concurrent, but that's the price of
> ensuring no holes.  Personally I'd rethink how badly you need that
> property.
>

another option is to create a table to use as a sequence, and lock
that table everytime you need a new value... is not concurrent also,
but at least faster... unless i'm missing something

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stan S 2011-10-17 21:35:21 BUG #6259: Collation Error with Citext fields
Previous Message Tom Lane 2011-10-17 19:43:09 Re: BUG #6258: Lock Sequence