Re: Field Size - Mailing list pgsql-admin

From Somasekhar Bangalore
Subject Re: Field Size
Date
Msg-id BF493B193A334743AA9EF48945E69C13518E54@exchange.india.zensutra.com
Whole thread Raw
Responses Re: Field Size  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-admin

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@magnusquest.com]
Sent: Monday, December 08, 2003 6:26 PM
To: pgsql-sql@postgresql.org; pgsql-admin@postgresql.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

 

pgsql-admin by date:

Previous
From: "Marc A. Leith"
Date:
Subject: Re: Field Size
Next
From: Ashok Chauhan
Date:
Subject: timestamp field