Re: Any justification for sequence table vs. native sequences?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: Doug Gorley <doug(dot)gorley(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Any justification for sequence table vs. native sequences?
Date: 2009-08-18 21:39:39
Message-ID: 5030.1250631579@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bill Moran <wmoran(at)potentialtech(dot)com> writes:
> And yes, it's pretty much guaranteed to be slower than built in sequences, with
> blocking when multiple threads want a sequence all at the same time.

It's also going to create a vacuum bottleneck unless the insert rate is
quite low, because each ID assignment will create another dead row in
the sequence management table.

> I'm rather concerned by the third column, as I'm not sure what his implementation
> approach is, and I'm concerned that he's using a home-brewed locking mechanism
> instead of using table locks.

Indeed, that looks a bit scary/pointless. You could at least use
SELECT FOR UPDATE to lock the rows.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2009-08-18 21:45:59 Re: Access Control System - Design
Previous Message Alvaro Herrera 2009-08-18 21:38:19 Re: index "pg_authid_rolname_index" is not a btree