查询IO相关SQL
2015-04-15 15:10
99 查看
--查询当前执行IO最多的sql,并按大到小来排序
select parsing_schema_name, cast(buffer_gets / decode(executions, 0, 10000, executions) as int) 平均io,
executions 执行次数,
buffer_gets 总逻辑io,
disk_reads 硬盘读取,
sql_text sql语句
from v$sqlarea
where parsing_schema_name = 'AML2010' --属主
order by buffer_gets desc;
--查找前十条性能差的sql
select *
from (select parsing_user_id,
executions,
sorts,
command_type,
disk_reads,
sql_text
from v$sqlarea
order by disk_reads desc)
where rownum <= 10;
--查看占io较大的正在运行的session
select se.sid,
se.serial#,
pr.spid,
se.username,
se.status,
se.terminal,
se.program,
se.module,
se.sql_address,
st.event,
st.p1text,
st.p1,
st.p2,
st.p3,
st.state,
st.seconds_in_wait,
si.physical_reads,
si.block_changes
from v$session se, v$session_wait st, v$sess_io si, v$process pr
where st.sid = se.sid
and st.sid = si.sid
and se.paddr = pr.addr
and se.sid > 6
and st.wait_time = 0
and st.event not like '%SQL%'
order by physical_reads desc;
select b.spid,
c.piece,
a.username,
a.machine,
a.program,
a.sid,
a.serial#,
a.status,
c.piece,
c.sql_text,
d.sql_fulltext
from v$session a, v$process b, v$sqltext c, v$sqlarea d
where b.addr = a.paddr
and a.sql_address = c.address(+)
and c.sql_id = d.sql_id
and a.sql_id = d.sql_id
and b.spid = '10438'
order by c.piece
--查询走哪些SQL走了全表扫描
select distinct a.sql_text, a.sql_id, b.options, a.last_load_time, b.operation
from v$sql a, v$sql_plan b
where a.sql_id = b.sql_id
and a.last_load_time like '2015-04-15%'
and b.options = 'FULL'
and b.operation = 'TABLE ACCESS'
select parsing_schema_name, cast(buffer_gets / decode(executions, 0, 10000, executions) as int) 平均io,
executions 执行次数,
buffer_gets 总逻辑io,
disk_reads 硬盘读取,
sql_text sql语句
from v$sqlarea
where parsing_schema_name = 'AML2010' --属主
order by buffer_gets desc;
--查找前十条性能差的sql
select *
from (select parsing_user_id,
executions,
sorts,
command_type,
disk_reads,
sql_text
from v$sqlarea
order by disk_reads desc)
where rownum <= 10;
--查看占io较大的正在运行的session
select se.sid,
se.serial#,
pr.spid,
se.username,
se.status,
se.terminal,
se.program,
se.module,
se.sql_address,
st.event,
st.p1text,
st.p1,
st.p2,
st.p3,
st.state,
st.seconds_in_wait,
si.physical_reads,
si.block_changes
from v$session se, v$session_wait st, v$sess_io si, v$process pr
where st.sid = se.sid
and st.sid = si.sid
and se.paddr = pr.addr
and se.sid > 6
and st.wait_time = 0
and st.event not like '%SQL%'
order by physical_reads desc;
select b.spid,
c.piece,
a.username,
a.machine,
a.program,
a.sid,
a.serial#,
a.status,
c.piece,
c.sql_text,
d.sql_fulltext
from v$session a, v$process b, v$sqltext c, v$sqlarea d
where b.addr = a.paddr
and a.sql_address = c.address(+)
and c.sql_id = d.sql_id
and a.sql_id = d.sql_id
and b.spid = '10438'
order by c.piece
--查询走哪些SQL走了全表扫描
select distinct a.sql_text, a.sql_id, b.options, a.last_load_time, b.operation
from v$sql a, v$sql_plan b
where a.sql_id = b.sql_id
and a.last_load_time like '2015-04-15%'
and b.options = 'FULL'
and b.operation = 'TABLE ACCESS'
相关文章推荐
- sql日记(相关子查询,动态交叉表篇)
- [收藏]sql查询性能调试,用SET STATISTICS IO和SET STATISTICS TIME
- SQL的IO阻塞者的查询
- Scripts:查询每个数据文件使用效率的脚本perf_file_io_efficiency.sql
- sql查询性能调试 用SET STATISTICS IO和SET STATISTICS TIME
- SQL语句实现查询当前数据库IO等待状况
- SQL 获取查询IO信息
- SQL--相关子查询 与 非相关子查询
- sql查询性能调试,用SET STATISTICS IO和SET STATISTICS TIME
- SQL的IO阻塞者的查询
- SQL高级查询相关
- IO相关SQL
- SQL查询相关技术-6.SQL操作(自选设置条件)
- 【Oracle】查询锁的相关SQL
- information_schema中Innodb相关表用于分析sql查询锁的使用情况介绍
- mysql 查询一个表中有的记录且在另一个表中无相关的记录sql
- information_schema中Innodb相关表用于分析sql查询锁的使用情况介绍
- sql时间查询相关
- sql相关子查询的一个小知识点
- 本人开发系统--新生报到与数据统计管理系统--数据库设计及相关查询SQL语句笔记