pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Re: CHAR or VARCHAR
Date: Sun, 25 Mar 2001 20:11:08 -0800
Message-ID: <web-29769@davinci.ethosmedia.com> (raw)
In-Reply-To: <19429.985554891@sss.pgh.pa.us>

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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (11+ messages)

Message-ID: <web-29769@davinci.ethosmedia.com>
Permalink:  ../web-29769@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-29769@davinci.ethosmedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: CHAR or VARCHAR
  In-Reply-To: <web-29769@davinci.ethosmedia.com>
  References: <19429.985554891@sss.pgh.pa.us> <web-29769@davinci.ethosmedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox