Re: Disadvantages to using "text" - Mailing list pgsql-novice

From Aurynn Shaw
Subject Re: Disadvantages to using "text"
Date
Msg-id 4821D282.1020001@commandprompt.com
Whole thread Raw
In response to Disadvantages to using "text"  ("Don Mies (NIM)" <dmies@networksinmotion.com>)
Responses Re: Disadvantages to using "text"  (Bruce Hyatt <brucejhyatt@yahoo.com>)
Re: Disadvantages to using "text"  (Frank Bax <fbax@sympatico.ca>)
List 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@commandprompt.com

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Disadvantages to using "text"
Next
From: Bruce Hyatt
Date:
Subject: Re: Disadvantages to using "text"