Re: The speed problem of Varchar vs. Char

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: The speed problem of Varchar vs. Char
Дата
Msg-id 18910.1183939142@sss.pgh.pa.us
обсуждение исходный текст
Ответ на The speed problem of Varchar vs. Char  (Crystal <support@conceptpatterns.com>)
Ответы Re: The speed problem of Varchar vs. Char  (Tim Tassonis <timtas@cubic.ch>)
Список pgsql-general
Crystal <support@conceptpatterns.com> writes:
> Our company need to save contact details into the PostgreSQL database. I
> just begin to learn it, so I got many questions. I am not sure which
> data type I should choose for website address, varchar or char.

Use varchar.  Or text, if you don't have a specific upper limit in mind.

> The website address may be very long, and we also don't want to lose the
> speed. Thus, the question is: if we have a large contact database, how
> much slowdown or speed up will be expected if we choose variable length
> rather than fixed length? Thanks forward.

Once upon a time, in the days of 80-column punch cards and no
variable-length character encodings, there were databases that could
handle fixed-width character fields a bit faster than variable-width.
That doesn't apply to Postgres.  There is no, none, nada performance
advantage to char(n), and you should never use it unless your
application data clearly demands a specific field width.

            regards, tom lane

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

Предыдущее
От: "Josh Tolley"
Дата:
Сообщение: Re: The speed problem of Varchar vs. Char
Следующее
От: Crystal
Дата:
Сообщение: Re: The speed problem of Varchar vs. Char