Search Postgresql Archives

Re: auto-increment field : in a simple way

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux