Re: Difference between varchar and text?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Difference between varchar and text?
Date: 2012-11-18 07:29:56
Message-ID: 23648.1353223796@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Johnston <polobo(at)yahoo(dot)com> writes:
> On Nov 17, 2012, at 20:43, John R Pierce <pierce(at)hogranch(dot)com> wrote:
>> I think he meant a tiny tiny bit faster, primarily due to not having to validate the length.

> Maybe... But I would presume a "varchar with no limit" does not validate length...

There is overhead from the type system for varchar, whether or not it
has a length limit --- you'll get at least some RelabelType nodes in
expression trees, and those don't have zero cost to execute.

I'd generally recommend using "text" if you don't have any interest in
enforcing a specific length limit.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-11-18 07:33:02 Re: Prepared Statement Name Truncation
Previous Message Tom Lane 2012-11-18 07:24:03 Re: [GENERAL] Prepared Statement Name Truncation