Re: Suggestions please: names for function cachability

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Suggestions please: names for function cachability
Date: 2002-04-03 00:59:35
Message-ID: Pine.LNX.4.30.0204021951430.686-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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(at)gmx(dot)net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Sojan 2002-04-03 01:10:10 Re: Problem with referential integrity within functions (bug?)
Previous Message mlw 2002-04-03 00:51:47 Re: Suggestions please: names for function cachability attributes

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-04-03 01:40:13 ANALYZE after restore
Previous Message mlw 2002-04-03 00:51:47 Re: Suggestions please: names for function cachability attributes