Re: Can this function be declared IMMUTABLE?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <beickhof(at)Lexmark(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can this function be declared IMMUTABLE?
Date: 2007-08-28 19:25:38
Message-ID: 87ps17lavh.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> beickhof(at)Lexmark(dot)com writes:
>> Well, I am considering a function that does select from a table, but the
>> table contents change extremely infrequently (the table is practically a
>> list of constants). Would it be safe to declare the function IMMUTABLE
>> provided that the table itself is endowed with a trigger that will drop
>> and recreate the function any time the table contents are modified?
>
> What you'd want to do is restart all existing sessions so that any plans
> made using precomputed function values are discarded. The trigger you
> suggest is fairly pointless because it will not cause regeneration of
> plans.

The trigger would alert him if there were any indexes built using the
function...

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-08-28 19:31:10 Re: Seeking datacenter PITR backup suggestions
Previous Message Tom Lane 2007-08-28 19:24:10 Re: PickSplit method of 2 columns ... error