Re: auto-increment field : in a simple way - Mailing list pgsql-general

From Craig Ringer
Subject Re: auto-increment field : in a simple way
Date
Msg-id 50767994.7030002@ringerc.id.au
Whole thread Raw
In response to auto-increment field : in a simple way  (Vineet Deodhar <vineet.deodhar@gmail.com>)
List 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 by date:

Previous
From: Craig Ringer
Date:
Subject: Re: moving from MySQL to pgsql
Next
From: Vineet Deodhar
Date:
Subject: Re: moving from MySQL to pgsql