Re: [HACKERS] varchar/char size

From: Zeugswetter Andreas DBT <Andreas(dot)Zeugswetter(at)telecom(dot)at>
To: "'pgsql-hackers(at)hub(dot)org'" <pgsql-hackers(at)hub(dot)org>
Subject: Re: [HACKERS] varchar/char size
Date: 1998-01-08 10:11:35
Message-ID: 219F68D65015D011A8E000006F8590C60F251F@sdexcsrv1.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter T Mount 1998-01-08 14:17:03 Did the patch get recieved?
Previous Message Hannu Krosing 1998-01-08 09:37:39 Re: I want to change libpq and libpgtcl for better handling of large query