From: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
---|---|
To: | Vineet Deodhar <vineet(dot)deodhar(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: auto-increment field : in a simple way |
Date: | 2012-10-11 07:47:32 |
Message-ID: | 50767994.7030002@ringerc.id.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Vineet Deodhar | 2012-10-11 09:07:23 | Re: moving from MySQL to pgsql |
Previous Message | Craig Ringer | 2012-10-11 07:42:58 | Re: moving from MySQL to pgsql |