Re: auto-increment field : in a simple way

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: auto-increment field : in a simple way
Дата
Msg-id 50767994.7030002@ringerc.id.au
обсуждение исходный текст
Ответ на auto-increment field : in a simple way  (Vineet Deodhar <vineet.deodhar@gmail.com>)
Список pgsql-general
On 10/11/2012 03:04 PM, Vineet Deodhar wrote:

>      user_id smallint NOT  NULL  DEFAULT  nextval('user_id_seq')

I'm kind of puzzled about why you'd want to use a serial on a field that
can contain at most 65,536 entries anyway. If you're only going to have
a max of 65,536 entries then the space saving over INTEGER is at most
65536*2 = 131072 bytes or 128kb for the table.

Planning on creating many thousands of these tables? If you're not, then
it isn't worth caring. If you are, then you're automating it so you
won't mind doing it the longhand way.

If you're creating few enough tables that you care about the syntax of
defining an unusually small data type for a generated primary key,
you're creating few enough that the space doesn't actually matter.

--
Craig Ringer


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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: moving from MySQL to pgsql
Следующее
От: Vineet Deodhar
Дата:
Сообщение: Re: moving from MySQL to pgsql