Re: Difference between varchar and text?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Vick Khera <vivek(at)khera(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Difference between varchar and text?
Date: 2012-11-19 01:10:46
Message-ID: 19385.1353287446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> On Sun, Nov 18, 2012 at 4:35 PM, Vick Khera <vivek(at)khera(dot)org> wrote:
>> On Sun, Nov 18, 2012 at 7:24 PM, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
>>> That depends on the PostgreSQL version. Some changes were made to improve
>>> that recently; from memory, it used to require rewriting, so people would
>>> sometimes work around it with (dodgy and unsafe) hacks directly to the
>>> system catalogs. I'm not sure if "recently" is 9.2 or 9.3.

> Just looking at the timing of the below, I'd say the optimization of
> varchar(n) to text took place in 9.1.

9.1 is bright enough to optimize that specific case; 9.2 covers some
additional cases like varchar(m) to varchar(n) for m <= n. I think also
that 9.2 avoids rebuilding indexes on the affected column in some of
these cases, but 9.1 did not.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ike Nnabugwu 2012-11-19 02:13:34 Fuzzystrmatch contrib module on RHEL63
Previous Message Jeff Janes 2012-11-19 00:45:00 Re: Difference between varchar and text?