Re: Increment a sequence by more than one

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Increment a sequence by more than one
Дата
Msg-id dcc563d10708031245j6698a5a2rda51a21e666f14b@mail.gmail.com
обсуждение исходный текст
Ответ на Increment a sequence by more than one  (Steve Midgley <public@misuse.org>)
Список pgsql-sql
Oh, another point.  You should run the

alter sequence m increment 5000;
select nextval('m');
alter sequence m increment 1;

one right after the other to reduce the number of 5000 wide holes in
your sequence.

Or, given the size of bigint, you could just set the increment to 5000
and leave it there, and then any insert could grab nextval('m') and
insert up to 5000 more ids with monotonically increasing ids safely.

Note you wouldn't use defaults or nextvals for the rest, you'd have to
calculate them in your application.


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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Increment a sequence by more than one
Следующее
От: Erik Jones
Дата:
Сообщение: Re: Foreign Key inter databases