• 查看Oracle最耗时的SQL


    有很多种方法可以用来找出哪些SQL语句需要优化,但是很久以来,最简单的方法都是分析保存在V$SQL视图中的缓存的SQL信息。通过V$SQL视图,可以确定具有高消耗时间、CUP和IO读取的SQL语句。


    1.查看总消耗时间最多的前10条SQL语句
    select *
      from (select v.sql_id,
                   v.child_number,
                   v.sql_text,
                   v.elapsed_time,
                   v.cpu_time,
                   v.disk_reads,
                   rank() over(order by v.elapsed_time desc) elapsed_rank
              from v$sql v) a
     where elapsed_rank <= 10;

     

    2.查看CPU消耗时间最多的前10条SQL语句
    select *
      from (select v.sql_id,
                   v.child_number,
                   v.sql_text,
                   v.elapsed_time,
                   v.cpu_time,
                   v.disk_reads,
                   rank() over(order by v.cpu_time desc) elapsed_rank
              from v$sql v) a
     where elapsed_rank <= 10;

     

    3.查看消耗磁盘读取最多的前10条SQL语句
    select *
      from (select v.sql_id,
                   v.child_number,
                   v.sql_text,
                   v.elapsed_time,
                   v.cpu_time,
                   v.disk_reads,
                   rank() over(order by v.disk_reads desc) elapsed_rank
              from v$sql v) a
     where elapsed_rank <= 10;

  • 相关阅读:
    获取APK的包名,和启动窗口类
    AS 中手动实现无线真机调试
    debian9安装jdk1.8
    java内存检测
    debian9设置pptp
    apache2 支持https
    centos安装python3
    debian laravel访问Mysql
    debian9下为apache启用rewrite模块,修改默认路径
    Java学习笔记(一)背景知识
  • 原文地址:https://www.cnblogs.com/fuhaots2009/p/3473342.html
Copyright © 2020-2023  润新知