Re: Suggestions please: names for function cachability - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Suggestions please: names for function cachability
Date
Msg-id Pine.LNX.4.30.0204021951430.686-100000@peter.localdomain
Whole thread Raw
In response to Suggestions please: names for function cachability attributes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Suggestions please: names for function cachability
Re: Suggestions please: names for function cachability
List pgsql-hackers
Tom Lane writes:

> Since I'm about to have to edit pg_proc.h to add a namespace column,
> I thought this would be a good time to revise the current proiscachable
> column into the three-way cachability distinction we've discussed
> before.  But I need some names for the values, and I'm not satisfied
> with the ideas I've had so far.

Well, for one thing, we might want to change the name to the correct
spelling "cacheable".

> 1. Strictly cachable (a/k/a constant-foldable): given fixed input
> values, the same result value will always be produced, for ever and
> ever, amen.  Examples: addition operator, sin(x).  Given a call
> of such a function with all-constant input values, the system is
> entitled to fold the function call to a constant on sight.

deterministic

(That's how SQL99 calls it.)

> 2. Cachable within a single command: given fixed input values, the
> result will not change if the function were to be repeatedly evaluated
> within a single SQL command; but the result could change over time.
> Examples: now(); datetime-related operations that depend on the current
> timezone (or other SET-able variables); any function that looks in
> database tables to determine its result.

"cacheable" seems OK for this.

> 3. Totally non-cachable: result may change from one call to the next,
> even within a single SQL command.  Examples: nextval(), random(),
> timeofday().  (Yes, timeofday() and now() are in different categories.
> See http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT)

not deterministic, not cacheable

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Barry Lind
Date:
Subject: Re: timeout implementation issues
Next
From: "Christopher Kings-Lynne"
Date:
Subject: ANALYZE after restore