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

Re: Disadvantages to using "text"

From: Aurynn Shaw <ashaw(at)commandprompt(dot)com>
To: "Don Mies (NIM)" <dmies(at)networksinmotion(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Disadvantages to using "text"
Date: 2008-05-07 16:02:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
> Are there any reasons for not using the “text” type whenever a variable 
> length string field is needed?  Are there penalties in disk usage, 
> memory usage or performance?
> What are the differences between declaring something “varchar” or 
> “varchar(n)” or “text”?  (I realize that the middle one has an upper 
> limit while the others do not.)

Actually, no, there's no reason to use varchar over text, unless you are 
wanting to explicitly limit the input length of your data.

Internally, Postgres treats a VARCHAR(n) as a TEXT with a CHECK 
constraint applied to it, so VARCHAR is going to be slightly slower to use.

Hope that helps,

Aurynn Shaw

The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 ext 103
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


In response to


pgsql-novice by date

Next:From: Richard BroersmaDate: 2008-05-07 16:03:57
Subject: Re: Disadvantages to using "text"
Previous:From: Rodrigo E. De León PlicetDate: 2008-05-07 16:01:09
Subject: Re: Disadvantages to using "text"

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