Re: please advise on column data type

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: please advise on column data type
Дата
Msg-id 9330.1018932432@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: please advise on column data type  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-sql
"Josh Berkus" <josh@agliodbs.com> writes:
> In some databases, yes.  However, in PostgreSQL, there is no
> performance difference between CHAR, VARCHAR, and TEXT.  So use what's
> appropriate for the data being stored.

In fact, char() is probably *worse* than the other alternatives, at
least for data that doesn't have a clearly defined length, because
it forces blank-padding on you.

I'd use char(N) for US postal abbreviations (state = char(2), etc)
and not a lot else.  If you have an *error checking* reason to use
char(N), then use it.  If you think you are getting a performance
improvement, then you are far out in left field.
        regards, tom lane


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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: please advise on column data type
Следующее
От: chief_87@yahoo.com (KeithR)
Дата:
Сообщение: help - JOIN problem