Re: IMMUTABLE STABLE functions, daily updates

From: Thom Brown <thom(at)linux(dot)com>
To: Sorin Dudui <sd(at)wigeogis(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: IMMUTABLE STABLE functions, daily updates
Date: 2011-11-10 13:25:01
Message-ID: CAA-aLv6HcRvYLHcHYuw2YY4Tfx+zBn5f6WsmGEzjSJSxPMErtg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 10 November 2011 13:05, Sorin Dudui <sd(at)wigeogis(dot)com> wrote:
> Hi,
>
>
>
> I have some functions that select data from tables which are daily or
> monthly updated.  My functions are marked as STABLE. I am wondering if they
> perform better if I mark they as IMMUTABLE?

No. IMMUTABLE is only appropriate when there is no access to table
data from within the function. An example of IMMUTABLE functions
would be mathematical operations, where only the inputs and/or
function constants are used to produce a result.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jay Levitt 2011-11-10 13:52:23 Re: Subquery in a JOIN not getting restricted?
Previous Message Sorin Dudui 2011-11-10 13:05:56 IMMUTABLE STABLE functions, daily updates