Re: Fwd: Sizes of sequences and serials

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Fwd: Sizes of sequences and serials
Дата
Msg-id 20713.1033098983@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Fwd: Sizes of sequences and serials  (elein <elein@sbcglobal.net>)
Список pgsql-general
elein <elein@sbcglobal.net> writes:
> According to the documentation, it looks like sequences
> are always stored as bigints (if the platform supports them).

Correct.

> Serials, though, seem to be able to be declared as serial
> with integer storage or serial8 for bigint storage.

> Is the storage for ordinary serials really an int and not
> a big int?

If you declare a serial (aka serial4) column, you get an int4 column
that's driven by a bigint sequence.  No problem except for a runtime
conversion from int8 to int4, which is really pretty negligible in
comparison to the cost of nextval().

> Is there a way to create a sequence stored as an int instead of a big
> int?

No; it wouldn't save anything anyway, seeing that each sequence is
stored as a separate table and so must occupy one disk block.

            regards, tom lane

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: get date in binary number format
Следующее
От: Tom Lane
Дата:
Сообщение: Re: get date in binary number format