Re: Constraint exclusion can't process simple constant expressions?

From: Brendan Jurd <direvus(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Constraint exclusion can't process simple constant expressions?
Date: 2011-04-21 02:17:11
Message-ID: BANLkTimHBZzEwSR+YBXCLAopvKKuh=1i5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 21 April 2011 12:13, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>> Emphasis on "always".  If the result of the function, given the same
>> argument values, can be different after a SET, then it doesn't qualify
>> for immutability.  At least, that's my understanding.
>
> Hmmmm.  But within the context of the query plan itself, the results of
> that expression are going to be constant.  That is, for a given query
> execution, it's always going to be the same comparison.
>

You may be thinking of the STABLE volatility level. It requires that
the results of the function are the same for the same inputs, within
the same transaction.

"STABLE indicates that the function cannot modify the database, and
that within a single table scan it will consistently return the same
result for the same argument values, but that its result could change
across SQL statements. This is the appropriate selection for functions
whose results depend on database lookups, parameter variables (such as
the current time zone), etc."

Cheers,
BJ

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2011-04-21 02:18:23 Re: Constraint exclusion can't process simple constant expressions?
Previous Message mark 2011-04-21 02:14:35 rant ? check the BBWC