Re: CHAR or VARCHAR - Mailing list pgsql-sql

From Josh Berkus
Subject Re: CHAR or VARCHAR
Date
Msg-id web-29769@davinci.ethosmedia.com
Whole thread Raw
In response to Re: CHAR or VARCHAR  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Folks -

> On other DBMSes there could be a difference, especially if the DBMS
> has
> performance problems with variable-length fields.

For example ... MS-SQL Server 7.0 requires 2 extra bytes to store the
length of a string for VARCHAR.  Thus, CHAR(3) takes 3 bytes (roughly)
and VARCHAR(3) takes 5.  Thus, if you knew that 90% of a particular
field's entries were going to be the same length, you could save some
storage space, and some processing power on scans and joins, by using
CHAR instead of VARCHAR.  (FYI, SQL Server 7 still has an 8K row limit;
I'm not sure about SQL Server 2000).

Now, Tom, at what point do character values begin to be stored "outside
the table"?  This is something I want to avoid, having had some bad
experiences with pointers and DB corruption (although not with PGSQL).

-Josh Berkus


______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Jie Liang
Date:
Subject: Re: about raise exception
Next
From: "Richard Huxton"
Date:
Subject: Re: Help