惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - lining

输出的客户端 - lining - 博客园 List<T> - lining - 博客园 DateTime 赋空值 配色达人速成 批处理文件,删除文件及文件夹 - lining - 博客园 Source Code中pfx的密码 查找所有有某一列的表 如何修改 app.config 的配置信息 用例的获得 如何oracle调试存储过程 C# 中String 和 string 有什么区别 ora-00997:非法使用LONG数据类型 oracle如何判断一个字符串是否为数字或日期 C# 中的计时器 populate a listbox on winform with values from database winform技巧,listbox绑定,value,text, - lining - 博客园 “Windows Workflow Foundation开发实战系列课程”中的数据库恢复 ASP.NET多语言版的开发 oracle数据导入导出imp/exp命令
查看oracle执行计划
lining · 2010-06-09 · via 博客园 - lining

查看oracle执行计划

from-> http://www.blogjava.net/kongji2008/archive/2009/08/12/290770.html

日常开发活动中,有时候需要对oracle执行计划进行监控,以此来调优程序和数据库方面的性能。
常用方法有以下几种:
一、通过PL/SQL Dev工具
    1、直接File->New->Explain Plan Window,在窗口中执行sql可以查看计划结果。其中,Cost表示cpu的消耗,单位为n%,Cardinality表示执行的行数,等价 Rows。
    2、先执行 EXPLAIN PLAN FOR   select * from tableA where paraA=1,再 select * from table(DBMS_XPLAN.DISPLAY)便可以看到oracle的执行计划了,看到的结果和1中的一样,所以使用工具的时候推荐使用1方法。
注意:PL/SQL Dev工具的Command window中不支持set autotrance on的命令。还有使用工具方法查看计划看到的信息不全,有些时候我们需要sqlplus的支持。
二、通过sqlplus
    1、一般情况都是本机链接远程服务器,所以命令如下:
            sqlplus user/pwd@serviceName
        此处的serviceName为tnsnames.ora中定义的命名空间。
    2、执行set autotrace on,然后执行sql语句,会列出以下信息:
。。。(省略一些信息)
统计信息
----------------------------------------------------------
          1  recursive calls (归调用次数)
          0  db block gets 
          2  consistent gets
          0  physical reads (物理读——执行SQL的过程中,从硬盘上读取的数据块个数)
          0  redo size (重做数——执行SQL的过程中,产生的重做日志的大小)
        358  bytes sent via SQL*Net to client
        366  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          0  sorts (memory)     在内存中发生的排序
          0  sorts (disk)     在硬盘中发生的排序
          1  rows processed
省略部分信息和通过PL/SQL Dev工具查看执行计划的信息一样,下面的统计信息是更详细的。
判断SQL效率高低不关通过时间来衡量,还应该通过执行SQL执行状态里面的逻辑读的数量
    逻辑读=(db block gets+ consistent gets)