Re: Varchar vs varchar(64)

From: "Philip W(dot) Dalrymple" <pwd(at)mdtsoft(dot)com>
To: Rob Richardson <Rob(dot)Richardson(at)rad-con(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Varchar vs varchar(64)
Date: 2008-10-21 13:11:26
Message-ID: 4711937.77261224594686126.JavaMail.root@is-mail-2.mdtsoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Well, I would guess that whoever designed the DB structure was used to
non-Postgres databases. First see

http://www.postgresql.org/docs/8.3/static/datatype-character.html

for the tip in Para. 7 on that page.

Most Data Bases DO require much more effort (i.e. don't run as fast)
if you use unlimited size data fields but Postgres is different.

If either an old version of Postgres was the target for the original
design or the designer had not read the above item then the result is
varchar(nn) being used where for a pure Postgres system a TEXT (or varchar)
field is a better design.

----- Original Message -----
From: "Rob Richardson" <Rob(dot)Richardson(at)rad-con(dot)com>
To: pgsql-general(at)postgresql(dot)org
Sent: Tuesday, October 21, 2008 8:07:31 AM GMT -05:00 US/Canada Eastern
Subject: [GENERAL] Varchar vs varchar(64)

Greetings!

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?

Thank you very much!

RobR

--
This email, and any files transmitted with it, is confidential
and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email in error,
please advise postmaster(at)mdtsoft(dot)com <mailto:postmaster(at)mdtsoft(dot)com>.

New MDT Software Headquarters (As of July 1, 2008):
3480 Preston Ridge Road
Suite 450
Alpharetta, GA 30005

Philip W. Dalrymple III <pwd(at)mdtsoft(dot)com>
MDT Software - The Change Management Company
+1 678 297 1001
Fax +1 678 297 1003

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2008-10-21 13:23:44 Re: How to free disk space
Previous Message Brandon Metcalf 2008-10-21 13:07:50 syncing with a MySQL DB