Re: Sequence skipping values

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: Sequence skipping values
Дата
Msg-id 43ECD40B.6040005@pinpointresearch.com
обсуждение исходный текст
Ответ на Sequence skipping values  (Jean-Christophe Roux <jcxxr@yahoo.com>)
Ответы Re: Sequence skipping values  (Michael Fuhr <mike@fuhr.org>)
Re: Sequence skipping values  (Jean-Christophe Roux <jcxxr@yahoo.com>)
Список pgsql-general
Jean-Christophe Roux wrote:
>   Hello,
> I have a table with and id field (primary key) which default value is
> the result of a sequence (increment explicitly set to 1).
> To my surprise, the real increment on insert is the total number of rows
> of the table. For instance, with 41 rows and a sequence last_value of
> 1141, the next insert row will have a value of 1182. It is not a big
> problem but I don't like skipping and wasting values in a sequence.
> Also, I'd like to understand what's going on!
> If someone could give me a clue that wold be greatly appreciated
> thanks
> JC

Any rules, triggers, etc. involved? How are the inserts done (insert one
record into the table)? What relationships does the table have to any
other tables? Anything else accessing that sequence?

There is no guarantee that a sequence will be contiguous. For example,
begin...insert into...rollback  will not reset the sequence as other
transactions could have incremented the sequence.

Cheers,
Steve

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Sequence skipping values
Следующее
От: Bob Pawley
Дата:
Сообщение: Re: Tool