Oracle 视图 V$SQL_CS_HISTOGRAM 官方解释,作用,如何使用详细说明

本站中文解释

视图

V$SQL_CS_HISTOGRAM视图是Oracle数据库中内置的,用于查看绑定变量执行情况的视图。它可以用来收集和分析SQL语句在不同绑定变量环境下的执行次数以及返回行数的情况,从而进一步优化SQL语句的性能。

访问V$SQL_CS_HISTOGRAM视图的语法:

SELECT * FROM V$SQL_CS_HISTOGRAM WHERE sql_id = ”
其中,SQL_ID 是SQL语句的唯一标识符。

可以使用以下字段进行查询:
BUCKET_NUMBER:绑定变量分配范围索引号;
VAL_TYPE:绑定变量的数据类型;
ENDPOINT_VALUE:绑定变量分配的范围;
ELEMENT_COUNT:处于绑定变量范围的语句的执行次数,行数;
MIN_ETIME:执行此范围的语句的最小执行时间;
AVERAGE_ETIME:执行此范围的语句的平均执行时间;
MAX_ETIME:执行此范围的语句的最大执行时间。

例如,下面的查询会返回 对应的SQL语句记录的所有绑定变量信息:
SELECT * FROM V$SQL_CS_HISTOGRAM WHERE sql_id = ” ORDER BY BUCKET_NUMBER ASC;

通过使用V$SQL_CS_HISTOGRAM视图,可以发现SQL语句分配给不同绑定变量的执行次数,返回行数及执行时间,从而对表的索引、变量的值进行调整,合理利用资源,以提高SQL语句的性能。

官方英文解释

V$SQL_CS_HISTOGRAM summarizes the monitoring information stored by adaptive cursor sharing. This information is used to decide whether to enable extended cursor sharing for a query. It is stored in a histogram, whose bucket’s contents are exposed by this view.
Column Datatype Description

ADDRESS

RAW(4 | 8)

Address of the handle to the parent for this cursor

HASH_VALUE

NUMBER

Hash value of the parent statement in the library cache

SQL_ID

VARCHAR2(13)

SQL identifier of the parent cursor in the library cache

CHILD_NUMBER

NUMBER

Number of the child cursor being monitored

BUCKET_ID

NUMBER

Bucket number of the monitoring histogram

COUNT

NUMBER

Value in this bucket of the histogram

CON_ID

NUMBER

The ID of the container to which the data pertains. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data


数据运维技术 » Oracle 视图 V$SQL_CS_HISTOGRAM 官方解释,作用,如何使用详细说明