当前位置:网站首页>Oracle Performance Analysis 3: introduction to tkprof
Oracle Performance Analysis 3: introduction to tkprof
2022-07-06 21:57:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
tkprof It is Oracle It comes with a command in line tool , Its main function is to trace the original file to the type of text file , for example , The easiest way , Use the following :
tkprof ly_ora_128636.trc ly_ora_128636.txt
tkprof With many parameters , In most cases , Using these parameters will be very helpful for your analysis .
tkprof Parameters
Suppose it is executed without any parameters tkprof, It will print out the complete parameter list , With a simple description . The following is a description of the parameters :
explain For every one SQL Statement provides a run plan .
This parameter needs to specify the user 、 password . You can also specify the database connection string , Such as :explain=user/[email protected]_string perhaps explain=user/password.
table Carton explain Parameters , Used to specify the table used to generate the run plan , It is usually not necessary to specify , Only when users cannot create tables ( In the absence of create table jurisdiction ). print Used to restrict output file generation SQL Number of statements , such as :print=10. aggregate Specify whether to process the same content separately SQL sentence . By default, it is not handled separately . Designated as aggregate=no, Look at each one alone SQL sentence .
insert Generate SQL Script ,SQL Scripts can be used to store information into databases ,SQL The name of the script is specified by the parameter , Such as :insert=load.sql. sys Appoint sys User executed SQL Whether the statement is also written to the output file , Default yes.
record Generate SQL Script . Included in trace All non recursive statements found in the file , The script name is specified by the parameter itself . such as :record=replay.sql.
waits Whether to add information about waiting events , Default join . sort Specify the SQL Order of statements . The default is trace Found in the document SQL The order .
Here's an example :
tkprof {input trace file} {output file} sys=no sort=prsela,exeela,fchela
prsela: The first cursor parsing takes time exeela: Time spent running against cursor fchela: The time it takes the cursor to get the data row
tkprof Output
The output file has a header , There are descriptions of parameters . For example, the following :
**********************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
**********************************************************************
count: Number of database calls run cpu: Processing data calls takes CPU Time , In seconds elapsed: Total time spent processing database calls , In seconds disk: Number of data blocks physically read , Suppose it is greater than the number of logical reads (disk>query+current), Indicates that a temporary table space is used .
query: The number of fast reads from the cache logic in consistent mode . Used as a query . current: The number of blocks read from the cache logic in the current mode , be used for insert、delete、merge as well as update Wait for the operation . rows: Number of data rows processed . The query represents the number of rows obtained . and insert、delete、merge as well as update Etc. indicates the number of rows affected .
Here is a detailed example :
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 501 0.03 0.15 0 1465 0 50001
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 503 0.03 0.15 0 1465 0 50001
The above corresponds to parse、execute and fetch this 3 Stages . stay fetch Phase is running 501 Time fetch, Got 50001 Row data , Every time fetch obtain 100 Row data . Next is :
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 5
The first two lines indicate the number of hard parsing that occurs in the parsing and running call phases . Suppose there is no hard parsing . There is no . “Optimizer mode” Represents the optimizer pattern .
“Parsing user id” It's parsing SQL The user of the statement . After that, you can see the operation plan , Here is just a simple explanation :
Rows Row Source Operation
------- ---------------------------------------------------
50001 COUNT STOPKEY (cr=1465 pr=0 pw=0 time=300125 us)
50001 VIEW (cr=1465 pr=0 pw=0 time=200088 us)
50001 INDEX FULL SCAN IDX_HISTORYALARM$CLEAR (cr=1465 pr=0 pw=0 time=100049 us)(object id 53743)
cr: Number of data blocks read out logically in consistency mode pr: The number of data blocks physically read from the disk pw: Number of data blocks physically written to disk time: The total time-consuming in subtle terms , Note that the data is inaccurate cost: The evaluation cost of the operation ( only 11g To provide ) size: The predicted amount of data returned by the operation ( Number of bytes )( only 11g To provide ) card: The expected number of rows returned by the operation ( only 11g To provide )
Next is waiting for the event :
Event waited on Times Waited Max. Wait Total Waited
----------------------------------------------------------------------------------
SQL*Net message to client 502 0.00 0.00
SQL*Net message from client 502 0.08 15.42
SQL*Net more data to client 500 0.00 0.01
Times Waited: Waiting time takes up time Max. Wait: Maximum waiting time for a single waiting event , The unit is in seconds Total Waited: Total waiting seconds for a waiting event . Imprecise
Here you can see the waiting events encountered during the operation , Through the analysis of these waiting events . It helps you understand what resources you are waiting for , The bottleneck of query , Targeted optimization .
In the Oracle Database Reference In a short narrative, the manual in the appendix describes the most common waiting events .
Copyright notice : This article is the original article of the blogger . Blog , Do not reprint without permission .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117071.html Link to the original text :https://javaforall.cn
边栏推荐
- MPLS experiment
- The underlying implementation of string
- MySQL - transaction details
- numpy 下载安装
- 50 commonly used numpy function explanations, parameters and usage examples
- Reset Mikrotik Routeros using netinstall
- Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
- bat脚本学习(一)
- Comparison between multithreaded CAS and synchronized
- LeetCode学习记录(从新手村出发之杀不出新手村)----1
猜你喜欢
Efficiency tool +wps check box shows the solution to the sun problem
PostgreSQL 修改数据库用户的密码
Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
PostgreSQL 安装gis插件 CREATE EXTENSION postgis_topology
C# 如何在dataGridView里设置两个列comboboxcolumn绑定级联事件的一个二级联动效果
50个常用的Numpy函数解释,参数和使用示例
GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
uni-app App端半屏连续扫码
GPS从入门到放弃(十九)、精密星历(sp3格式)
jvm:大对象在老年代的分配
随机推荐
GPS从入门到放弃(十九)、精密星历(sp3格式)
hdu 4912 Paths on the tree(lca+馋)
Quick access to video links at station B
guava:Collections. The collection created by unmodifiablexxx is not immutable
Earned value management EVM detailed explanation and application, example explanation
guava: Multiset的使用
抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
Is it important to build the SEO foundation of the new website
Why rdd/dataset is needed in spark
Efficiency tool +wps check box shows the solution to the sun problem
记一次清理挖矿病毒的过程
MySQL removes duplicates according to two fields
Technology sharing | packet capturing analysis TCP protocol
新入职一家公司需要去实践和注意的内容
强化学习-学习笔记5 | AlphaGo
Sequoia China, just raised $9billion
Sql: stored procedures and triggers - Notes
The role of applicationmaster in spark on Yan's cluster mode
C语言:#if、#def和#ifndef综合应用
美国科技行业结束黄金时代,芯片求售、裁员3万等哀声不断