Skip site navigation (1) Skip section navigation (2)

Re: varchar vs text columns

From: Lew <lew(at)lewscanon(dot)nospam>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: varchar vs text columns
Date: 2007-07-24 13:16:49
Message-ID: ZbCdnTkmkddcZjjbnZ2dnUVZ_gudnZ2d@comcast.com (view raw or flat)
Thread:
Lists: pgsql-admin
Andrew Sullivan wrote:
> On Mon, Jul 23, 2007 at 11:33:54AM -0700, Jessica Richard wrote:
>> What is the difference between varchar and text for a string column?
>> What is the benefit of using each one?
>> Is text better than varchar performance wise?
> 
> From the manual:
> 
> 	Tip:  There are no performance differences between these
> 	three types, apart from the increased storage size when using
> 	the blank-padded type. While character(n) has performance
> 	advantages in some other database systems, it has no such
> 	advantages in PostgreSQL. In most situations text or
> 	character varying should be used instead.
> 
> Note that varchar(n) will have a performance effect, because on
> insert or update you have to check to make sure the input doesn't
> exceed the specified length.  

See also Peter Koczan's reply in the '"_" in a serach  pattern' thread.

-- 
Lew

In response to

pgsql-admin by date

Next:From: Tom LaneDate: 2007-07-24 14:04:10
Subject: Re: problems installing postgresql on Mandriva linux
Previous:From: techDate: 2007-07-24 11:48:55
Subject: Set up a database without backup

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group