Re: CHAR or VARCHAR
| От | Tom Lane |
|---|---|
| Тема | Re: CHAR or VARCHAR |
| Дата | |
| Msg-id | 25819.985273537@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: CHAR or VARCHAR ("Martin A. Marques" <martin@math.unl.edu.ar>) |
| Ответы |
Re: CHAR or VARCHAR
|
| Список | pgsql-sql |
"Martin A. Marques" <martin@math.unl.edu.ar> writes:
> How does performace look when doing lots of searches on a VARCHAR
> column with respect of a CHAR column? That is my main concern.
There is *no* performance advantage of CHAR(n) over VARCHAR(n).
If anything, there is a performance lossage due to extra disk I/O
(because all those padding blanks take space, and time to read).
My advice is to use CHAR(n) when that semantically describes your data
(ie, truly fixed-width data, like US postal codes), or VARCHAR(n) when
that semantically describes your data (ie, variable-width with a hard
upper bound), or TEXT when that semantically describes your data (ie,
variable width with no specific upper bound). Worrying about
performance differences is a waste of time, because there aren't any.
regards, tom lane
В списке pgsql-sql по дате отправления: