Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f9D3shr47779 for ; Fri, 12 Oct 2001 23:54:43 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id f9D3sQH01372; Fri, 12 Oct 2001 23:54:26 -0400 (EDT) From: Bruce Momjian Message-Id: <200110130354.f9D3sQH01372@candle.pha.pa.us> Subject: Re: VARCHAR vs TEXT In-Reply-To: "from Stephan Szabo at Oct 10, 2001 05:18:25 pm" To: Stephan Szabo Date: Fri, 12 Oct 2001 23:54:26 -0400 (EDT) CC: Aasmund Midttun Godal , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200110/165 X-Sequence-Number: 5120 > 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:

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.

-- 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