Re: Disadvantages to using "text"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Hyatt <brucejhyatt(at)yahoo(dot)com>
Cc: Aurynn Shaw <ashaw(at)commandprompt(dot)com>, "Don Mies \(NIM\)" <dmies(at)networksinmotion(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Disadvantages to using "text"
Date: 2008-05-07 16:54:51
Message-ID: 15021.1210179291@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Bruce Hyatt <brucejhyatt(at)yahoo(dot)com> writes:
> VARCHAR is slower too? There's no check on VARCHAR, is there?

Well, all the textual operators/functions are actually declared to take
and return type TEXT, so when you are working with VARCHAR columns the
expressions have no-op cast nodes in them ("RelabelType" nodes), even
if it's an unconstrained-length VARCHAR. I'm not sure whether the
execution cost of these would be measurable in real applications, but
it's not zero. A bigger problem is that sometimes the planner gets
confused by the RelabelTypes and fails to find as good a plan as it
finds for a pure-TEXT query. Now if you run into that kind of problem
it's a bug and should be reported, but nonetheless you'll get stuck with
bad plans until it's fixed ...

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Frank Bax 2008-05-07 16:55:14 Re: Disadvantages to using "text"
Previous Message Bruce Hyatt 2008-05-07 16:44:10 Re: Disadvantages to using "text"