Re: varchar vs. text - Mailing list pgsql-general

From Tom Lane
Subject Re: varchar vs. text
Date
Msg-id 8493.1063859240@sss.pgh.pa.us
Whole thread Raw
In response to varchar vs. text  (Michael Garriss <mgarriss@earthlink.net>)
Responses Re: varchar vs. text
List pgsql-general
Michael Garriss <mgarriss@earthlink.net> writes:
> I curious about the benefits of a varchar over text.

1. Compliance to the letter of the SQL spec.
2. Ability to define a maximum length, if you happen to feel the need to
   impose a specific maximum length.  (If you don't have a good reason
   to impose any particular max length, this is a minus not a plus,
   because the spec says you have to pick one anyway.)

> Is it speed,

It's a loser on speed because of the extra cycles spent to check the
max length.  Other than those cycles, there is no difference.

            regards, tom lane

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: High-volume shop uses PostgreSQL
Next
From: Michael Garriss
Date:
Subject: Re: varchar vs. text