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。

原文地址:http://blog.51cto.com/2012ivan/2121406

时间: 2024-10-14 09:27:50

v$sql v$sqlarea v$sqltext的相关文章

Oracle v$sql,v$sqlarea,v$sqltext区别

v$sqltext中有内存中完整的sql语句(SQL被分割为多行存储),而其他两个视图都是部分sql语句.但v$sqltext中存储的比较简单,没有该语句的统计信息,比如执行次数等. v$sqltext 的字段如下: ADDRESS       RAW(4 | 8)     Used with HASH_VALUE to uniquely identify a cached cursor  HASH_VALUE    NUMBER         Used with ADDRESS to uni

oracle sql资源消耗相关视图

一.常用视图说明 Oracle sql语句资源消耗监控,最常用的系统视图有: v$sql v$sqlarea v$sqltext v$session v$sql和v$sqlarea基本相同,记录了共享SQL区(share pool)中SQL统计信息,如内存消耗.IO(物理磁盘读和逻辑内存读).排序操作.哈希ID等数据.不同之处在于v$sql为每一条SQL保留一个条目,而v$sqlarea中根据sql_text(需要注意,该处存储的为当前SQL指针的前1000个字符,也就是说这里记录的SQL可能是

[转] sql_id VS hash_value

有没有发现,v$session,v$sql,v$sqlarea,v$sqltext,v$sql_shared_cursor等试图连接的时候经常会用到hash_value,sql_id,但是他们2个之间到底有什么不可告人的关系呢? Talnel以及评论的一坨人(包括jonathan)给了一个蛮不错的解释: SQL_ID is just a fancy representation of hash value [email protected]>select kglnahsv, kglnahsh f

怎样使用oracle 的DBMS_SQLTUNE package 来执行 Sql Tuning Advisor 进行sql 自己主动调优

 怎样使用oracle 的DBMS_SQLTUNE package 来执行 Sql Tuning Advisor 进行sql 自己主动调优 1>.这里简单举个样例来说明DBMS_SQLTUNE 的使用 首先现运行下某个想要调优的sql,然后获取sqlid SQL> select * from v$sqltext where sql_text like 'select * from dual%'; ADDRESS          HASH_VALUE SQL_ID        COMMA

16 SQL Tuning Overview

16.1 Introduction to SQL Tuning Identifying high load or top SQL statements that are responsible for a large share of the application workload and system resources, by reviewing past SQL execution history available in the system Verifying that the ex

SQL优化的方法论

•找到最占用资源的SQL语句 –V$SQLAREA (Shared_pool) –V$session_longops(6秒) –StatsPack Report –SQL*Trace + TKProf –10g ADDM –Toad.Quest Data Center –… •问题定位 How to find Bad SQL –V$SQLAREA (Shared_pool) –StatsPack –SQL*Trace + TKProf –10g ADDM •优化SQL语句 –理解优化器.CBO

如何使用oracle 的DBMS_SQLTUNE package 来运行 Sql Tuning Advisor 进行sql 自动调优

 如何使用oracle 的DBMS_SQLTUNE package 来运行 Sql Tuning Advisor 进行sql 自动调优 1>.这里简单举个例子来说明DBMS_SQLTUNE 的使用 首先现执行下某个想要调优的sql,然后获取sqlid SQL> select * from v$sqltext where sql_text like 'select * from dual%'; ADDRESS          HASH_VALUE SQL_ID        COMMAND

所有表和动态视图列表(dict)2

V$FILE_HISTOGRAM    Synonym for V_$FILE_HISTOGRAMV$FILE_OPTIMIZED_HISTOGRAM    Synonym for V_$FILE_OPTIMIZED_HISTOGRAMV$FILE_PING    Synonym for V_$FILE_PINGV$FIXED_TABLE    Synonym for V_$FIXED_TABLEV$FIXED_VIEW_DEFINITION    Synonym for V_$FIXED_VI

整理一些dba的面试题[转]

一:SQL tuning 类1:列举几种表连接方式hash join/merge join/nest loop(cluster join)/index join 2:不借助第三方工具,怎样查看sql的执行计划set autot on explain plan set statement_id = &item_id for &sql; select * from table(dbms_xplan.display);http://download-west.oracle.com/docs/cd