Re: Field Size

From: "Somasekhar Bangalore" <sbangalore(at)zensutra(dot)com>
To: "Ganesan Kanavathy" <ganesh(at)magnusquest(dot)com>, <pgsql-sql(at)postgresql(dot)org>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Field Size
Date: 2003-12-08 13:06:57
Message-ID: BF493B193A334743AA9EF48945E69C13518E54@exchange.india.zensutra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

There is no harm in having a field size of 1000 character provided u use the proper datatype. Don't user char(1000). Try using varchar(1000).

For character data it is recommended to use the VARCHAR type, since PostgreSQL manages it very well. On the contrary, if you use the CHAR datatype, the size you specify for the string is pre-allocated in the pages and you allocate space which may not be used. So your database is bigger than what it should be and performance is lowered, because this way you need more I/O to read the data.

Som

-----Original Message-----
From: Ganesan Kanavathy [mailto:ganesh(at)magnusquest(dot)com]
Sent: Monday, December 08, 2003 6:26 PM
To: pgsql-sql(at)postgresql(dot)org; pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] Field Size

Can anyone tell me, what harm would setting a field size to 1000 characters do to the size?

By increasing the size, will the database require more space? Or does it only consume space if there is data in the field only?

Regards,
Ganesan

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ashok Chauhan 2003-12-08 13:21:55 timestamp field
Previous Message Jerrianna Fox 2003-12-08 13:04:14 Question

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2003-12-08 15:35:52 Re: Field Size
Previous Message Marc A. Leith 2003-12-08 13:03:12 Re: Field Size