Re: [HACKERS] varchar/char size

Zeugswetter Andreas <andreas.zeugswetter@telecom.at>

From: Zeugswetter Andreas DBT <Andreas.Zeugswetter@telecom.at>
To: "'pgsql-hackers@hub.org'" <pgsql-hackers@hub.org>
Date: 1998-01-08T10:11:35Z
Lists: pgsql-hackers
Bruce wrote:
> 
> On Wed, 7 Jan 1998, Bruce Momjian wrote:
>> 
>> > In my experience, char() is full size as defined by create, and
>> > varchar() is the the size of the actual data in the field, like
text,
>> > but with a pre-defined limit.
>> 
>> 	Can you remind me what the difference is between text and
varchar?  Why
>> would you use varchar over text?
>
>Only because SQL people are used to varchar, and not text, and
sometimes
>people want to have a maximum size if they are displaying this data in
a
>form that is only of limited size

1. Thanks for the very nice change !
2. now the difference:
	- varchar must fit directly into tuple
	- varchar enforces a supplied max length (as in varchar(256))
	- text has no size limit (2Gb in Informix) (therefore should be
pointer to LOB iff >= max row size)
	- max size of varchar is limited by max row size (32k)
	- max size can be used to align btree index (advantage ?
(Informix does it))
	- therefore varchar better performance than text for small texts
(implementation specific)
	- index for text ? (is btree useful for avg. 50k html pages ? I
don't think so.)

Andreas