Re: Immutable function WAY slower than Stable function? - Mailing list pgsql-general

From Christophe Pettus
Subject Re: Immutable function WAY slower than Stable function?
Date
Msg-id 5257764C-551F-458A-896D-EDA75FD77F13@thebuild.com
Whole thread Raw
In response to Re: Immutable function WAY slower than Stable function?  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general
> On Aug 7, 2018, at 11:42, Ken Tanzer <ken.tanzer@gmail.com> wrote:
> I assume that's "for all users and all sessions," but either in theory or in practice is there a limit to how long a
stalevalue might persist?  And, if you were to drop and recreate a function with the same name & parameters, would it
startfresh at that point?  And is there a way to flush any caching?  (It's surely best to just declare Stable, but I'm
wonderingabout cases that might have _very_ infrequently-changed values.) 

Well, the extreme case is an IMMUTABLE function used to create an expression index; then, the value lasts as long as
theindex does.  The best way to think of an IMMUTABLE is that it is a pure function, unchanged by system state.  (This
isone of the reasons that datetime-related functions are often STABLE rather than IMMUTABLE, due to time zone changes.) 

--
-- Christophe Pettus
   xof@thebuild.com



pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Immutable function WAY slower than Stable function?
Next
From: Tom Lane
Date:
Subject: Re: Immutable function WAY slower than Stable function?