Re: Varchar vs varchar(64)

Поиск
Список
Период
Сортировка
Искать
От
Albe Laurenz
Тема
Re: Varchar vs varchar(64)
Дата
Msg-id
D960CB61B694CF459DCFB4B0128514C202A1AB28@exadv11.host.magwien.gv.at
Ответ на
Varchar vs varchar(64) (Rob Richardson)
Список
Дерево обсуждения
How to free disk space "Ruben Blanco" <rubenblan@gmail.com>
Varchar vs varchar(64) "Rob Richardson" <Rob.Richardson@rad-con.com>
Re: Varchar vs varchar(64) "Philip W. Dalrymple" <pwd@mdtsoft.com>
Re: Varchar vs varchar(64) "Albe Laurenz" <laurenz.albe@wien.gv.at>
Re: Varchar vs varchar(64) Tom Lane <tgl@sss.pgh.pa.us>
Re: How to free disk space Devrim GÜNDÜZ <devrim@gunduz.org>
Re: How to free disk space Raymond O'Donnell <rod@iol.ie>
Re: How to free disk space "postgres Emanuel CALVO FRANCO" <postgres.arg@gmail.com>
Re: How to free disk space Robert Treat <xzilla@users.sourceforge.net>
Re: How to free disk space "Scott Marlowe" <scott.marlowe@gmail.com>
Re: How to free disk space "Grzegorz Jaśkiewicz" <gryzman@gmail.com>
Re: How to free disk space "Scott Marlowe" <scott.marlowe@gmail.com>
Rob Richardson wrote:
> The database we install at our customers as part of our 
> product includes an event_history table.  For some reason 
> lost in the mists of time, the most important field in that 
> table, the description, is a varchar field specified to be 
> only 64 characters long.  This leads me to a more fundamental 
> question:  why specify the length of a varchar field at all?  
> Is there a big difference between the amount of disk space 
> taken up by "abc" stored in a varchar(64) field and stored in 
> a varchar field?  How much space does an unspecified-length 
> varchar field take up?  Are there other reasons to use 
> varchar(64) instead of varchar?

You can't have "varchar" without a length in parentheses,
as far as I know.

But you can use "text" which is essentially the same thing.

I can think of two reasons to use varchar(n) instead of text:
- you deliberately want to limit the amount of characters.
- you want to index the column (indexes have a maximum row size).

It is not a performance issue, however, and there is no
wasted space either.

Yours,
Laurenz Albe
В списке pgsql-general по дате отправления
От: Howard Cole
Дата:
От: Karl Nack
Дата:
FAQ