This has been discussed before in the context of misunderstanding the 
meaning of 'iscachable', but I now have a use for cached function results, 
and have seen at least one other posting with a similar need.

The reason I need it is that I have a few functions that do recursive 
inheritance lookups going up a converging inheritance tree. Typically this 
function will be called on several hundred objects in a single select 
statement. Because of inheritance, it ends up with several thousand 
function calls, each of which is non-trivial.

A solution that would be useful for me would be:

If a function is marked 'invariant' (or something similar), then

- cache the most recently used 20 calls (config item) iff the args were 
less than 1K in total storage (ie. don't cache large text blocks),

- calculate a very simple checksum on the args

- when a function is to be evaluated, calc the checksum and if a match is 
found, compare the args, and if they all match, return the result.

I would anticipate deleting the cache when the current command exits, 
and/or certainly when a TX ends.

Obviously this is not a 7.3 item, but would people support such 
functionality going into a future version?





----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                  |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to