Re: Performance problem in textanycat/anytextcat

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Performance problem in textanycat/anytextcat
Date: 2010-05-16 18:59:00
Message-ID: 5177.1274036340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Sun, May 16, 2010 at 1:11 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> No, only the ones that are built on top of other functions that aren't
>> immutable.

> Built on top of? I don't get it. It seems like anything of the form
> immutablefunction(volatilefunction()) is vulnerable to this,

Uh, no, you misunderstand completely. The problematic case is where the
function's own expansion contains a non-immutable function. In
particular, what we have for these functions is that textanycat(a,b)
expands to a || b::text, and depending on what the type of b is, the
cast from that to text might not be immutable. This is entirely
independent of whether the argument expressions are volatile or not.
Rather, the problem is that inlining the function definition could
by itself increase the expression's apparent volatility. (Decreasing
the volatility is not problematic. Increasing it is.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-05-16 23:00:08 Re: Performance problem in textanycat/anytextcat
Previous Message Jaime Casanova 2010-05-16 18:50:29 Re: Performance problem in textanycat/anytextcat