Andrew Sullivan <andrew(at)libertyrms(dot)info> writes:
> On Fri, Aug 29, 2003 at 11:34:13AM -0400, Bill Moran wrote:
>> Have any explanation as to why that function is so slow?
> Sorry, no. It might have to do with the planning, though.
Specifically, I'll bet he's getting an indexscan plan with one and not
with the other. It's just ye olde cross-datatype-comparisons-aren't-
indexable problem. "varchar = varchar" matches the index on the varchar
column, but "text = text" is a different operator that doesn't match.
Guess which one gets selected when the initial input is "varchar = text".
7.4 has fixed this particular problem by essentially eliminating the
separate operators for varchar, but in prior releases the behavior
Oliver describes is entirely to be expected. A workaround is to
cast inside the function:
... where varcharcolumn = textarg::varchar;
so that "=" gets interpreted as "varchar = varchar".
regards, tom lane
In response to
pgsql-performance by date
|Next:||From: Shridhar Daithankar||Date: 2003-08-29 16:29:14|
|Subject: 2.4 v/s 2.6 again.|
|Previous:||From: Ken Geis||Date: 2003-08-29 16:06:31|
|Subject: Re: bad estimates|