Re: Data TYPE Creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Houssay Guillaume <ghoussay(at)noos(dot)fr>, pgsql-general(at)postgresql(dot)org
Subject: Re: Data TYPE Creation
Date: 2003-03-17 14:42:05
Message-ID: 6028.1047912125@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> Houssay Guillaume <ghoussay(at)noos(dot)fr> wrote:
>> What about the disk space ? By defining an INT2 with a constraint of 1 byte, how much space will be used in the memory (1 byte or 2 bytes). This is really one of my concern.

> The extra disc space won't be that much because there is other information
> being stored besides that raw data. So that int2 won't take up twice as much
> space as int1 (note postgres doesn't have that type).

If the OP is desperate to feel that he's saving space, there's always
the "char" type (note the quotes) --- it's got an impoverished set of
operations and the I/O format is maybe not quite what's wanted, but it
does store as a single byte.

But Bruno is correct to point out that actual space savings is another
question. Unless you have quite a few such columns appearing
consecutively in a table, it's not worth worrying about, because in any
context except adjacent "char" columns, the space will disappear into
alignment padding for the next field anyway.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dekkers Intermediair 2003-03-17 14:53:58 postgreSQL as MSSQL2000 server?
Previous Message Bruno Wolff III 2003-03-17 14:17:51 Re: Data TYPE Creation