Type TEXT

Started by Jo�oover 23 years ago3 messagesgeneral
Jump to latest
#1Jo�o
batistellabr@yahoo.com.br

Hi!

I'm new to Postgre and I would like to know if is
there any problem of type text compared to VARCHAR?

Thanks.

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

#2Oliver Elphick
olly@lfix.co.uk
In reply to: Jo�o (#1)
Re: Type TEXT

On Thu, 2002-07-11 at 18:18, Joo Paulo Batistella wrote:

I'm new to Postgre and I would like to know if is
there any problem of type text compared to VARCHAR?

If you *know* that the length of text cannot or must not exceed n
characters, use VARCHAR(n); otherwise use TEXT.

There is no performance loss from using TEXT.

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"I waited patiently for the LORD; and he inclined unto
me, and heard my cry. He brought me up also out of an
horrible pit, out of the miry clay, and set my feet
upon a rock, and established my goings. And he hath
put a new song in my mouth, even praise unto our God.
Many shall see it, and fear, and shall trust in the
LORD." Psalms 40:1-3

#3Robert Treat
xzilla@users.sourceforge.net
In reply to: Oliver Elphick (#2)
Re: Type TEXT

The is actually a performance gain on text fields in regards to inserts,
so even in cases where you *think* that something wont go over n
characters if your application doesn't require it, you might want to
stick with text.

the main downside most people would mention is that "text" data types or
not sql standard so you might have a problem porting to other DBMS (not
that you'll want to d:] )

Robert Treat

Show quoted text

On Thu, 2002-07-11 at 13:40, Oliver Elphick wrote:

On Thu, 2002-07-11 at 18:18, Joo Paulo Batistella wrote:

I'm new to Postgre and I would like to know if is
there any problem of type text compared to VARCHAR?

If you *know* that the length of text cannot or must not exceed n
characters, use VARCHAR(n); otherwise use TEXT.

There is no performance loss from using TEXT.

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"I waited patiently for the LORD; and he inclined unto
me, and heard my cry. He brought me up also out of an
horrible pit, out of the miry clay, and set my feet
upon a rock, and established my goings. And he hath
put a new song in my mouth, even praise unto our God.
Many shall see it, and fear, and shall trust in the
LORD." Psalms 40:1-3

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org