Re: Data TYPE Creation

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Data TYPE Creation
Дата
Msg-id 20030317141751.GB19324@wolff.to
обсуждение исходный текст
Ответ на Data TYPE Creation  ("Guillaume Houssay" <ghoussay@noos.fr>)
Ответы Re: Data TYPE Creation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Mon, Mar 17, 2003 at 14:40:28 +0000,
  Houssay Guillaume <ghoussay@noos.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
anotherway. 

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

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Data TYPE Creation
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Data TYPE Creation