Bill Moran <wmoran@potentialtech.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