v$sql v$sqlarea v$sqltext

这里做个笔记,纯属是加深印象:

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.

明显v$sql的信息来源于共享内存区shared SQL areas,也就是说相关SQL信息在数据库重启,数据库缓存被刷,或相关SQL信息被踢出缓存区,此SQL的信息就不能在V$SQL里查询。而V$SQL记录每一个SQL的每一个子游标的信息。

V$SQLAREA displays statistics on shared SQL areas and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution.

同样v$sqlarea也存储于library cache,然而这个视图却做了一个统计分析,统计的方式是以sql string分组,也就是以sql_text文本做了group by,在此前提下对其他信息统计sum()。通过version_count可以得出SQL子游标的总数。所以简单的说:v$sqlarea存放的是相同SQL语句不同version一个汇总。

version_count:Number of child cursors that are present in the cache under this parent

excutions : Total number of executions, totalled over all the child cursors

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

v$sql及v$sqlarea存放的更多的是性能数据,但其sql_text是不完整的的,如果想获得完整的sql就要用v$sqltext。

转载于:https://blog.51cto.com/2012ivan/2121406

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值