Re: Best approach for a "gap-less" sequence

Поиск
Список
Период
Сортировка
От Jorge Godoy
Тема Re: Best approach for a "gap-less" sequence
Дата
Msg-id 87r6zktsm3.fsf@gmail.com
обсуждение исходный текст
Ответ на Re: Best approach for a "gap-less" sequence  (Ron Johnson <ron.l.johnson@cox.net>)
Ответы Re: Best approach for a "gap-less" sequence
Список pgsql-general
Ron Johnson <ron.l.johnson@cox.net> writes:

> Pre-allocate records.  The (primary key?) field would have the
> numbers already filled in, but all the rest of the fields in each
> record be NULL, blanks, zeros or indicator values ("~~~~~~~~~~",
> -999999999, etc).
>
> Then create a single-field table called, for example, CUR_MAX_VALUE
> that gets incremented as part of each transaction.  To serialize
> access, transactions would need an EXCLUSIVE lock on the table.

What's the difference to having just the table with the sequence where I make
an exclusive lock to get the value while inside the transaction?  This
approach seems more complicated since I'd have to exclude records that match
the "not-used" pattern.



--
Jorge Godoy      <jgodoy@gmail.com>

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Best approach for a "gap-less" sequence
Следующее
От: "Harpreet Dhaliwal"
Дата:
Сообщение: Re: Connection string