oracle 11g acs相关视图

来源:互联网 发布:java中boolean默认值 编辑:程序博客网 时间:2024/04/29 19:03

http://www.killdb.com/2011/06/19/11gr2-%E6%96%B0%E7%89%B9%E6%80%A7%E4%B9%8B%EF%BC%88%E4%B8%80%EF%BC%89adaptive-cursor-sharing%EF%BC%88acs%EF%BC%89.html


跟11g自适应游标共享功能相关的有几个新的视图,平时我们可以借此来进行监控,如下:
V$SQL_CS_SELECTIVITY
V$SQL_CS_STATISTICS
V$SQL_CS_HISTOGRAM

关于这3个视图,oracle metalink的解释如下:

V$SQL_CS_SELECTIVITY exposes the valid selectivity ranges for a child cursor in extendedcursor sharing mode. A valid range consists of a low and high valuefor each predicate containing binds. Each predicate's selectivity (with the current bind value) mustfall between the corresponding low and high values in order for the child cursor to be shared. V$SQL_CS_STATISTICS contains the raw execution statistics used by the monitoring componentof adaptive cursor sharing. A sample of the executions is monitored.This view exposes which executions were sampled, and what the statistics were for thoseexecutions. The statistics are cumulative for each distinct set of bind values. V$SQL_CS_HISTOGRAM summarizes the monitoring information stored by adaptive cursorsharing. This information is used to decide whether to enable extended cursor sharing for a query. Itis stored in a histogram, whose bucket's contents are exposed by this view.

V$SQL_CS_SELECTIVITY 用于查询cursor的最高值和最低值的选择性,oracle也正是根据其选择性来决定起执行计划的,不过内部机制现
在我还无法得知,比如 object_id 有1000个值,不可能每次不同的绑定变量值,oracle都去生成一个执行计划或产生一个child cursor,
那样的话,代价就非常高了。– 这个需要进一步研究。

V$SQL_CS_STATISTICS 从上面的查询,我们就可以看出,该视图用于查询每个child cursor的统计信息,比如buffer gets。
其实,从这个我们也可以用来判断sql的效率,这个不就是我们常说的逻辑读吗?

V$SQL_CS_HISTOGRAM 类似直方图一样,用于记录cursor的执行次数,从上面的查询,我们可以发现每个child cursor一共有3个bucket。
关于这里的bucket,目前还不知道是不是就是固定的3个bucket。– 这里也需要进一步研究证明。

另外如果修改了参数curso_sharing为similar或force的话,也可能会导致比较严重的后果,可能会出现大量的 mutex X waits for cursor等待。
故我们仍然建议设置为EXACT,从应用角度进行绑定变量。

既然我们说ACS功能很强悍,假如不想用这个功能呢,是否能关闭呢? 回答是肯定的,通过如下的方式:


ALTER system SET "_optimizer_extended_cursor_sharing_rel"=NONE;
ALTER system SET "_optimizer_extended_cursor_sharing"=NONE;
ALTER system SET "_optimizer_adaptive_cursor_sharing"=FALSE;


http://blog.csdn.net/robinson_0612/article/details/6923670
1、v$sql_cs_statistics
        用于监控自适应游标共享的相关统计信息.下面的查询中列出了每个子游标的peeking情况,以及执行次数,预处理行数,BUFFER_GETS等     
2、v$sql_cs_selectivity
        显示每个子游标的游标的选择性范围。下面的查询中列出了谓词,选择性范围,列上的选择性的值    
3、v$sql_cs_histogram
        用于决定一个查询是否允许自适应游标共享,以直方图形式存储   

原创粉丝点击