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: 4821D282.1020001@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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.

--
Aurynn Shaw

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

ashaw(at)commandprompt(dot)com

In response to

Responses

Browse pgsql-novice by date

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