Singer Wang <swang(at)cs(dot)dal(dot)ca> writes:
> if I have a column that's gonna be between 5-300 charactors...
> should I go with a a charactor? varchar? or a text?
> what's the performance penalty going with a text instead of a
> varchar... or a char? I don't need to index it.... nor search based
> on it..
PostgreSQL's varchar and text are both based on the same internal
type. Varchar only limits the length of the string that can be
inserted. Char pads the strings with ' ' to the desired lengh. In
other words if I were to insert 'Jason' into a char(8) it would be
padded to 'Jason '.
In other words, use varchar if you have a hard limit that you want to
enforce, char if you want to guarantee string lengths, and text for
In response to
pgsql-novice by date
|Next:||From: Brett W. McCoy||Date: 2002-02-12 21:01:34|
|Subject: Re: varchar vs char vs text|
|Previous:||From: Singer Wang||Date: 2002-02-12 20:19:54|
|Subject: varchar vs char vs text|