Re: BUG #11671: UNACCENT call with constant arg evaluated for each row

From: Thomas <t(dot)chaumeny(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11671: UNACCENT call with constant arg evaluated for each row
Date: 2014-10-14 20:43:47
Message-ID: CABAmR6fhbqt2hS0ix+bwPVYKOy_=o63H8bcFB7T4p2J=PuFiTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I understand that this is not a requirement for a STABLE function. Still,
from the user point of view, I think it's unfortunate — and unexpected for
those who don't know about UNACCENT not being defined as IMMUTABLE — that
UNACCENT calls will make some queries very slow (I have another table where
the execution time goes from < 400ms to 4s+ because of that).

Regards,

Thomas

On Tue, Oct 14, 2014 at 8:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> t(dot)chaumeny(at)gmail(dot)com writes:
> > Since UNACCENT function is defined as STABLE, I would expect its result
> to
> > be evaluated only once in the second query.
>
> The system does not promise any such thing for stable functions.
> STABLE is a marker that it is *safe* to evaluate the function fewer
> times than naive SQL semantics would suggest; it is not a requirement.
>
> regards, tom lane
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message flashmozzg 2014-10-14 20:44:29 BUG #11672: Bad practice in checking for disk C, SQL Shell
Previous Message Tom Lane 2014-10-14 18:40:30 Re: BUG #11671: UNACCENT call with constant arg evaluated for each row