Re: Constraint exclusion can't process simple constant expressions? - Mailing list pgsql-performance

From Brendan Jurd
Subject Re: Constraint exclusion can't process simple constant expressions?
Date
Msg-id BANLkTimHBZzEwSR+YBXCLAopvKKuh=1i5A@mail.gmail.com
Whole thread Raw
In response to Re: Constraint exclusion can't process simple constant expressions?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Constraint exclusion can't process simple constant expressions?
List pgsql-performance
On 21 April 2011 12:13, Josh Berkus <josh@agliodbs.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

pgsql-performance by date:

Previous
From: "mark"
Date:
Subject: rant ? check the BBWC
Next
From: Josh Berkus
Date:
Subject: Re: Constraint exclusion can't process simple constant expressions?