From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | mlw <markw(at)mohawksoft(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: with (iscachable) |
Date: | 2001-10-31 00:37:26 |
Message-ID: | 9106.1004488646@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
mlw <markw(at)mohawksoft(dot)com> writes:
> It seems there should be 3 core function cache levels:
There should be 3, but not defined like this:
> 1) "noncacheable," this should always be called every time it is used.
> 2) "cachable," this should mean that it will be called only once per unique set
> of parameters within a transaction.
> 3) "persistent," this could mean it never needs to be called twice.
We will *not* implement function caching as implied by #2. What we want
is a definition that says that it's okay to omit redundant calls, not
one that promises we will not make any redundant calls.
Reasonable definitions would be:
1. noncachable: must be called every time; not guaranteed to return same
result for same parameters even within a query. random(), timeofday(),
nextval() are examples.
2. fully cachable: function guarantees same result for same parameters
no matter when invoked. This setting allows a call with constant
parameters to be constant-folded on sight.
3. query cachable: function guarantees same result for same parameters
within a single query, or more precisely within a single
CommandCounterIncrement interval. This corresponds to the actual
behavior of functions that execute SELECTs, and it's sufficiently strong
to allow the function result to be used in an indexscan, which is what
we really care about.
I'm by no means wedded to those names ... maybe someone can think of
better terminology.
> With the above definitions, it would make sense to have "iscacheable" as the
> default for a function.
I'd still vote for noncachable as the default; unsurprising behavior is
to be preferred over maximum performance IMHO.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-10-31 01:54:54 | Re: Postings from Bruce and Olivier rejected ... |
Previous Message | mlw | 2001-10-30 23:41:31 | with (iscachable) |