Return-Path: mao
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA04988; Mon, 7 Dec 92 20:30:47 -0800
Message-Id: <9212080430.AA04988@postgres.Berkeley.EDU>
From: <mao@postgres.berkeley.edu>
Subject: Re: Are functions computed just once?
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
In-Reply-To: Your message of Mon, 07 Dec 92 17:47:11 PST.
             <9212080147.AA04495@postgres.Berkeley.EDU> 
Date: Mon, 07 Dec 92 20:32:17 PST

In message <9212080147.AA04495@postgres.Berkeley.EDU> you write:

> 	retrieve (rel.attr) where rel.attr2 > some_func()
> 
> My question is, does some_func() get invoked just once and the result stored
> for each ensuing comparison, or does the darn function get computed each
> time?
> 
> If the latter, is there a way of saying "compute this thing once and no
> more"?

some_func() will be executed once per tuple in 4.0.1.  when a function is
defined, we allow the user to specify whether or not the function is
cacheable (actually, we allow the user to specify the lifetime of the
function's return value).  however, we don't use this information in
the current release of the system.

i'm not sure what the plans are for getting function cacheing into the
released system.  i'm pretty sure it won't be in 4.1.

					mike
