Bill Moran escribió:

> One thing that a lot of people seem to get confused about is that they
> subconsciously think that ints or bigints take up less space when the
> numbers are small.  I.e.: I want to use an int for my state identifier
> instead of the 2-digit code, because it will use less space -- wrong,
> an int is 4 bytes, but a 2 byte char column is 1/2 that ... even if the
> number never gets higher than 50.

Eh, a 2 byte char column uses 3 bytes -- there's one byte of overhead.
(Unless one of the chars is multibyte in which case it can be longer).
Earlier versions of Postgres use 6 bytes to store the 2 chars (4 bytes
of overhead), so it would be larger than the int.

Not that this invalidates the argument -- just nitpicking here.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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

Reply via email to