Re: [HACKERS] Function result cacheing - any comments?

2002-08-19 Thread Tom Lane
Philip Warner <[EMAIL PROTECTED]> writes: > At 15:41 19/08/2002 +0800, Christopher Kings-Lynne wrote: >> So it seems Philip already has what he wants? > I really hope so, but my understanding is that this information is used > during optimization, not execution; I want it to be used in execution

Re: [HACKERS] Function result cacheing - any comments?

2002-08-19 Thread Tom Lane
Philip Warner <[EMAIL PROTECTED]> writes: > My theory is that if such a piece of code gets a performance gain, then the > code is probably worth including, assuming that the function manager does > not need to be butchered to achieve the desired goal. Does that sound > reasonable? Some real re

Re: [HACKERS] Function result cacheing - any comments?

2002-08-19 Thread Philip Warner
At 15:41 19/08/2002 +0800, Christopher Kings-Lynne wrote: >So it seems Philip already has what he wants? I really hope so, but my understanding is that this information is used during optimization, not execution; I want it to be used in execution.

Re: [HACKERS] Function result cacheing - any comments?

2002-08-19 Thread Christopher Kings-Lynne
> >What Philip seems to be asking for is a mechanism where by if a function > >is marked as being mathematically deterministic (given a > particular set of > >parameters the same result is always returned -- eg: cos(), sin(), > >etc) then the result is cached and next time the function is called w

Re: [HACKERS] Function result cacheing - any comments?

2002-08-19 Thread Philip Warner
At 17:03 19/08/2002 +1000, Gavin Sherry wrote: >What Philip seems to be asking for is a mechanism where by if a function >is marked as being mathematically deterministic (given a particular set of >parameters the same result is always returned -- eg: cos(), sin(), >etc) then the result is cached

Re: [HACKERS] Function result cacheing - any comments?

2002-08-18 Thread Christopher Kings-Lynne
> What Philip seems to be asking for is a mechanism where by if a function > is marked as being mathematically deterministic (given a particular set of > parameters the same result is always returned -- eg: cos(), sin(), > etc) then the result is cached and next time the function is called with >

Re: [HACKERS] Function result cacheing - any comments?

2002-08-18 Thread Gavin Sherry
On Sun, 18 Aug 2002, Joe Conway wrote: > Philip Warner wrote: > > So the obvious question is - in the opinion of people who know the code, > > can a function-result-cache be implemented with a lifetime of a single > > statement, without butchering the function manager? > > > > I don't know if

Re: [HACKERS] Function result cacheing - any comments?

2002-08-18 Thread Philip Warner
At 22:29 18/08/2002 -0700, Joe Conway wrote: >create function get_manager_names() returns setof manager_names as > 'select d.id, p.name from departments d, people p > where p.id = d.manager_id' language sql; > >select p.name, m.name as boss from people p, get_manager_names() m where >p.d

Re: [HACKERS] Function result cacheing - any comments?

2002-08-18 Thread Joe Conway
Philip Warner wrote: > So the obvious question is - in the opinion of people who know the code, > can a function-result-cache be implemented with a lifetime of a single > statement, without butchering the function manager? > I don't know if I fully understand what you're proposing, but if I u

Re: [HACKERS] Function result cacheing - any comments?

2002-08-18 Thread Philip Warner
OK - I assume from everybody else's silence that they either (a) agree with the idea, or (b) think Tom hit the idea on the head, so they feel they don't need to respond. So what I would like to do is implement a simple version of this to attempt to justify my claims of performance gains. The

Re: [HACKERS] Function result cacheing

2002-08-16 Thread Philip Warner
At 00:18 17/08/2002 -0400, Tom Lane wrote: >Philip Warner <[EMAIL PROTECTED]> writes: > > Obviously this is not a 7.3 item, but would people support such > > functionality going into a future version? > >Actually, I wouldn't. This forces application-based caches, which in turn need indexed local

Re: [HACKERS] Function result cacheing

2002-08-16 Thread Tom Lane
Philip Warner <[EMAIL PROTECTED]> writes: > Obviously this is not a 7.3 item, but would people support such > functionality going into a future version? Actually, I wouldn't. I can think of very few situations where such caching is useful, and I don't believe that the mechanism required would p

[HACKERS] Function result cacheing

2002-08-16 Thread Philip Warner
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 look