Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group