oracle SQL的HASH_VALUE 理解

当执行SQL语句时,Oracle会在共享池中查找匹配的文本并尝试重执行现有子游标。如果所有现有子游标无法重用,Oracle会进行硬解析创建新的子游标。V$SQLTEXT显示SQL语句的文本,而V$SQL提供每个原始SQL文本子游标的统计信息。当父游标达到1024个子游标时,下次执行该SQL失败分享时,会标记父游标为过时并创建新父游标。
摘要由CSDN通过智能技术生成

To explain how this can happen: When a SQLstatement is executed, we find the matching text in the shared pool, if itexists. Then we try to reexecute an existing child cursor if possible. If allof the already existing children for that parent cursor cannot be reused (i.e.cannot be shared), Oracle needs to hard parse and thereby creates another childcursor. If we continue not-sharing existing child cursors, at the point when aparent has 1024 child cursors, the next time a user attempts to execute thatSQL text and there is a failure to share any of these cursors, the parent with1024 cursors is marked as obsolete, and a new parent is created.

 


sql_address

sql_hash_value

V$SQLTEXT

V$SQLTEXT displays the text of SQL statements belonging to shared SQL cursors in the SGA.

Column Datatype Description
ADDRESS RAW(4 | 8) Used with HASH_VALUE to uniquely identify a cached cursor
HASH_VALUE NUMBER Used with ADDRESS to uniquely identify a cached cursor
SQL_ID VARCHAR2(13) SQL identifier of a cached cursor
COMMAND_TYPE NUMBER Code for the type of SQL statement (SELECTINSERT, and so on)
PIECE NUMBER Number used to order the pieces of SQL text
SQL_TEXT VARCHAR2(64) A column containing one piece of the SQL text



V$SQL

V$SQL lists statistics on shared SQL areas without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.

Column Datatype Description
SQL_TEXT VARCHAR2(1000) First thousand characters of the SQL text for the current cursor
SQL_FULLTEXT CLOB Full text for the SQL statement exposed as a CLOB column. The full text of a SQL statement can be retrieved using this column instead of joining with the V$SQLTEXT dynamic performance view.
SQL_ID VARCHAR2(13) SQL identifier of the parent cursor in the library cache
SHARABLE_MEM NUMBER Amount of shared memory used by the child cursor (in bytes)
PERSISTENT_MEM NUMBER Fixed amount of memory used for the lifetime of the child cursor (in bytes)
RUNTIME_MEM NUMBER Fixed amount of memory required during the execution of the child cursor
SORTS NUMBER
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值