pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: Aasmund Midttun Godal <postgresql@envisity.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: VARCHAR vs TEXT
Date: Fri, 12 Oct 2001 23:54:26 -0400 (EDT)
Message-ID: <200110130354.f9D3sQH01372@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.BSF.4.21.0110101716300.89375-100000@megazone23.bigpanda.com>

> On Wed, 10 Oct 2001, Aasmund Midttun Godal wrote:
> 
> > I am sure this question has been answered in some form or another
> > before, but I can't really find anything on exactly this issue.
> > 
> > Are there any differences between varchar and text other than
> > 
> > 1. varchar has limited size
> > 2. varchar is SQL 92 text is not?
> > 
> > Especially regarding performance.
> > 
> > Or am I correct to assume that if you need a place to store some text,
> > and you are not sure how much (like an email address or a name) you
> > are best off using text?
> 
> Pretty much yes.  text and varchar are pretty equivalent other than
> the fact that varchar specifies a maximum size.

I have added the following paragraph to the FAQ:

    <P>CHAR() is best when storing strings that are usually the
    same length.  VARCHAR() is best when storing variable-length strings,
    but you want to limit how long a string can be.  TEXT is for strings
    of unlimited length, maximum 1 gigabyte.  BYTEA is for storing
    binary data, particularly values that include NULL bytes.</P>

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (11+ messages)  latest in thread

Message-ID: <200110130354.f9D3sQH01372@candle.pha.pa.us>
Permalink:  ../200110130354.f9D3sQH01372@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200110130354.f9D3sQH01372@candle.pha.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, sszabo@megazone23.bigpanda.com, postgresql@envisity.com
  Subject: Re: VARCHAR vs TEXT
  In-Reply-To: <200110130354.f9D3sQH01372@candle.pha.pa.us>

* 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