RESULT_CACHE为空的RELIES_ON [英] Empty RELIES_ON for RESULT_CACHE

查看:140
本文介绍了RESULT_CACHE为空的RELIES_ON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在函数内部使用RESULT_CACHE进行查询.

I have a query inside the function with RESULT_CACHE.

因此,在更改表时-我的缓存无效,并且再次执行了功能.

So when the table is changed - my cache is invalidated and function is executed again.

我想要实现的功能仅依赖于输入参数,而不依赖于任何隐式依赖关系(如表等).

What I want is to implement the function that depends only on input parameters, and doesn't depend on any implicit dependencies (like tables, etc).

是否可以(没有动态sql)?

Is it possible (without dynamic sql)?

推荐答案

可以将仅依赖于其参数的函数声明为DETERMINISTIC.在某些情况下,此功能的结果将被缓存. OTN论坛上的线程显示了确定性函数结果如何在SQL内部缓存声明.

a function that depends only on its parameters can be declared DETERMINISTIC. The results of this function will be cached in some cases. This thread on the OTN forums shows how deterministic function results get cached inside SQL statements.

从10gR2开始,函数结果不会跨SQL语句缓存,也不会缓存在PL/SQL中.不过,如果您在SELECT中调用某个函数可能会花很多时间的时候,此缓存功能还是很有用的.

As of 10gR2, the function results don't get cached across SQL statements nor do they get cached in PL/SQL. Still, this cache feature can be useful if you call a function in a SELECT where it might get called lots of time.

我现在没有11gR2实例,因此我无法测试RESULT_CACHE功能,但是您是否考虑过依赖固定的伪表(例如,一个永不更新的表)来释放函数?

I don't have a 11gR2 instance available right now, so I can't test the RESULT_CACHE feature, but have you considered delaring your function relying on a fixed dummy table (a table that never gets updated for instance)?

这篇关于RESULT_CACHE为空的RELIES_ON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆