Search Postgresql Archives

varchar(n) VS text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Having read http://www.postgresql.org/docs/8.2/interactive/datatype-character.html
I am puzzling over this issue:

1) Is there ever ANY reason to prefer "varchar(n)" to "text" as a column type?

2) For instance, if I know that a character-type column will never
contain more than 300 characters, would I be better to define it as
"varchar(300)" or as "text"?

3) What if, in practice that same column usually contains strings of
no more than 10 characters (although I can't guarantee that it
wouldn't explode up to 300 in the one-in-a-million case)?

4) On the other hand, what if a column systematically contains strings
of 5 or fewer characters.  Is it better to define it as "varchar(5)"
or as "text"?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux