Re: Are globally defined constants possible at all ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Are globally defined constants possible at all ?
Дата
Msg-id 5885.1023639124@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Are globally defined constants possible at all ?  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Список pgsql-general
"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> ... I still can't see how use of CHECK makes the mapping from a textual type
> to integer.

It doesn't.  The point people are making is that storing a (short) text
string is a perfectly respectable way to do this.

If you're feeling a compulsion to micro-optimize, though, I'd recommend
the trick I used to use: use datatype "char" (note the quotes).  This is
*one* byte on disk, even smaller than integer, and you can still choose
characters with some mnemonic value for your different states.  This
method works pretty well up to a dozen or two possible states, after
which it starts to get hard to choose values; but beyond that point
I'd think a separate table is the way to go anyway.

            regards, tom lane

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

Предыдущее
От: "Nigel J. Andrews"
Дата:
Сообщение: Re: Are globally defined constants possible at all ?
Следующее
От: Darren Ferguson
Дата:
Сообщение: Re: Are globally defined constants possible at all ?