Re: Serial Jumping

Поиск
Список
Период
Сортировка
Искать
От
Bill Moran
Тема
Re: Serial Jumping
Дата
Msg-id
20090127001448.aa35061b.wmoran@potentialtech.com
Ответ на
Serial Jumping (db.subscriptions@shepherdhill.biz)
Список
Дерево обсуждения
Re: Serial Jumping Jasen Betts <jasen@xnet.co.nz>
db.subscriptions@shepherdhill.biz wrote:
>
> Hi,
> 
> I have a table with BIG SERIAL field as Primary KEY. During high load,
> entries in the BIG SERIAL field are jumped. One could see a row with
> 1367 and expecting the next INSERT to be 1368, one would end up
> getting 1369.
> 
> Please is this normal?

If transactions rollback, the serial value assigned during the rolled
back transaction is skipped.  This has been discussed many times, it's
a tradeoff between losing some #s now and again and taking a huge
performance and code complexity hit to avoid it.

If you absolutely need consecutive #s, then serial is not for you and
you should implement your own method of acquiring sequential numbers.

-- 
Bill Moran
http://www.potentialtech.com
В списке pgsql-general по дате отправления
От: db.subscriptions@shepherdhill.biz
Дата:
Сообщение: Serial Jumping
От: Craig Ringer
Дата:
Сообщение: Re: Serial Jumping
FAQ