Re: Difference between varchar and text?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Difference between varchar and text?
Date: 2012-11-18 01:11:53
Message-ID: k89ckp$3r8$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2012-11-05, Moshe Jacobson <moshe(at)neadwerx(dot)com> wrote:
> --14dae93404f5f865d804cdc59353
> Content-Type: text/plain; charset=ISO-8859-1
>
> Is there any practical difference between defining a column as a
> varchar(n)vs. a varchar
> vs. a text field?
>
> I've always been under the impression that if I am wanting to index a
> varchar column, it is better to set a maximum length.

It doesn't really matter, the index itself will impose the limit
(unless you use a hash index where ther is no limit)

> But more importantly, what's the practical difference between varchar with
> no limit and text?

text is immeasurably faster.

> Thanks, and apologies if this is a FAQ...

--
⚂⚃ 100% natural

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-11-18 01:37:34 Re: Difference between varchar and text?
Previous Message Marko Kreen 2012-11-17 21:43:23 Re: Plproxy with returns table() make PG segfault