Thread: varchar vs text

varchar vs text

From
"Sim Zacks"
Date:
Are there any differences between text and varchar? I found the following in
the docs, which leads me to believe that there are no differences at all.
Can someone please confirm this before I switch all my varchars to text?

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.



Re: varchar vs text

From
Martijn van Oosterhout
Date:
On Tue, Jan 04, 2005 at 09:50:18AM +0200, Sim Zacks wrote:
> Are there any differences between text and varchar? I found the following in
> the docs, which leads me to believe that there are no differences at all.
> Can someone please confirm this before I switch all my varchars to text?

Correct. The only difference between varchar and text is that varchar
can have a maximum length, which will be checked. As for storage used,
indexability, operators, etc they're identical.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment