Re: Data TYPE Creation

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Houssay Guillaume <ghoussay(at)noos(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Data TYPE Creation
Date: 2003-03-17 14:17:51
Message-ID: 20030317141751.GB19324@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 17, 2003 at 14:40:28 +0000,
Houssay Guillaume <ghoussay(at)noos(dot)fr> wrote:
> Thank you for your answer.
> By constraint you mean having the length of the INT2 field set to 1 ? I do not know how to define a constraint by another way.

create table example (col1 int check (col1 < 256 and col1 > 0));

This would only make sense if your data is really constrained this way.
The idea is to prevent invalid data from getting into the system, not to
save space.

>
> 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).

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-03-17 14:42:05 Re: Data TYPE Creation
Previous Message Bruno Wolff III 2003-03-17 13:29:32 Re: Data TYPE Creation