Question about varchar and text

Started by Stewart, Robert D (COT)over 21 years ago4 messagesgeneral
Jump to latest
#1Stewart, Robert D  (COT)
RobertD.Stewart@ky.gov

What is the difference between varchar and text?
I have heard that you can use text instead of varchar and this could speed
up your tables.

Robert Stewart
Network Eng
Governor's Office of Technology
101 Cold Harbor
Work # 502 564 9696
Cell # 502 330 5991
Email RobertD.Stewart@ky.gov

#2Derik Barclay
dbarclay@givex.com
In reply to: Stewart, Robert D (COT) (#1)
Re: Question about varchar and text

I don't know about running faster, but I believe the only difference between
the two in postgres is that a varchar has a limit on input. They are stored
and indexed the same.

On January 6, 2005 12:25 pm, Stewart, Robert D (COT) wrote:

What is the difference between varchar and text?
I have heard that you can use text instead of varchar and this could speed
up your tables.

Robert Stewart
Network Eng
Governor's Office of Technology
101 Cold Harbor
Work # 502 564 9696
Cell # 502 330 5991
Email RobertD.Stewart@ky.gov

-- 
Givex - http://www.givex.com/
Derik Barclay <dbarclay@givex.com>, Systems Software Engineer
+1 416 350 9660
+1 416 250 9661 (fax)
#3Thomas Braad Toft
pgsql-general@magicx.dk
In reply to: Stewart, Robert D (COT) (#1)
Re: Question about varchar and text

Hi!

Stewart, Robert D (COT) wrote:

What is the difference between varchar and text?

I have heard that you can use text instead of varchar and this could

speed up your tables.

http://www.postgresql.org/docs/7.4/interactive/datatype-character.html

Quote: "Tip: There are no performance differences between these three
types, apart from the increased storage size when using the blank-padded
type."

--
Thomas Braad Toft

#4Joshua D. Drake
jd@commandprompt.com
In reply to: Derik Barclay (#2)
Re: Question about varchar and text

Derik Barclay wrote:

I don't know about running faster, but I believe the only difference between
the two in postgres is that a varchar has a limit on input. They are stored
and indexed the same.

There is a theory that text is faster than varchar, because postgresql
doesn't have to check text. So it is one less thing for PostgreSQL to do
before it provides the tuple.

J

On January 6, 2005 12:25 pm, Stewart, Robert D (COT) wrote:

What is the difference between varchar and text?
I have heard that you can use text instead of varchar and this could speed
up your tables.

Robert Stewart
Network Eng
Governor's Office of Technology
101 Cold Harbor
Work # 502 564 9696
Cell # 502 330 5991
Email RobertD.Stewart@ky.gov

-- 
Command Prompt, Inc., home of PostgreSQL Replication, and plPHP.
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL