Re: Performance problem in textanycat/anytextcat

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Performance problem in textanycat/anytextcat
Date: 2010-05-16 18:50:29
Message-ID: AANLkTilQV_Z-bC6RSlq8lX93oi4F3PEuWQPN_vpPIdMu@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, May 16, 2010 at 1:20 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Sun, May 16, 2010 at 1:11 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>> Couldn't you apply this argument to any built-in immutable function whatsoever?
>>
>> 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, and you
> can give a volatile function as an argument to any function you like.
> If you're saying we're testing for immutability by looking only at the
> outermost function call, that seems pretty broken.
>

you mean we shouldn't allow this?

"""
select version();
version
-------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.4.0 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(GCC) 3.4.6 20060404 (Red Hat 3.4.6-10), 64-bit
(1 row)

create table t1 (col1 int);

create function f1(int) returns double precision as $$
select random() * $1;
$$ language sql immutable;

create index idx on t1(f1(col1));
"""

then, welcome to the club... there were various conversations on this same topic

--
Jaime Casanova www.2ndQuadrant.com
Soporte y capacitación de PostgreSQL

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-05-16 18:59:00 Re: Performance problem in textanycat/anytextcat
Previous Message Robert Haas 2010-05-16 18:20:23 Re: Performance problem in textanycat/anytextcat