Vladlen Popolitov 2025-08-19 08:39:50 wrote:> Hi! > > In your example function will be compiled (the tree is created in the > memory) > and executed. > During execution this function creates a plan for very simple query 1 > and stores it in the cache, than it creates a plan for query 10 and > store > in in the cache. There is no other queries, no more plans in the cache. > After execution function releases the tree (own code) from memory, > but cached queries are remains in the memory, it is why this cache is > created - > for usage by other queries. > > I do not know, what other cache of the stored procedure do you mean. I > suppose, > a stored procedure creates cached plans only for queries inside of the > procedure, > not for itself. > > -- > Best regards, > > Vladlen Popolitov.
I think you misunderstand Man's meaning. In Man's example, the func cache neither dropped (will cause memory leak) nor reused. So the question here: 1. Drop the cache when func dropped 2. Keep the cache and reused when func recreate I prefer the 2ed solution. Regards, Jet C.X. ZHANG Halo Tech (www.halodbtech.com) openHalo (www.openhalo.org)