Re: Disadvantages to using "text" - Mailing list pgsql-novice

From Tom Lane
Subject Re: Disadvantages to using "text"
Date
Msg-id 15021.1210179291@sss.pgh.pa.us
Whole thread Raw
In response to Re: Disadvantages to using "text"  (Bruce Hyatt <brucejhyatt@yahoo.com>)
Responses Re: Disadvantages to using "text"  (Bruce Hyatt <brucejhyatt@yahoo.com>)
List pgsql-novice
Bruce Hyatt <brucejhyatt@yahoo.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

pgsql-novice by date:

Previous
From: Bruce Hyatt
Date:
Subject: Re: Disadvantages to using "text"
Next
From: Frank Bax
Date:
Subject: Re: Disadvantages to using "text"