Re: CHAR or VARCHAR

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: CHAR or VARCHAR
Date: 2001-03-26 04:11:08
Message-ID: web-29769@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mohamed ebrahim 2001-03-26 07:36:31 Help
Previous Message Jie Liang 2001-03-26 04:03:13 Re: about raise exception