Re: Data TYPE Creation

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