当前位置:网站首页>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
边栏推荐
- MySQL - transaction details
- guava:Collections.unmodifiableXXX创建的collection并不immutable
- PostgreSQL modifies the password of the database user
- GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
- hdu 4912 Paths on the tree(lca+馋)
- GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
- PostgreSQL install GIS plug-in create extension PostGIS_ topology
- Sparkshuffle process and Mr shuffle process
- GPS从入门到放弃(十七) 、对流层延时
- 关于char[]数组通过scanf赋值使用上的一些问题。。
猜你喜欢
JS method to stop foreach
Huawei has launched attacks in many industries at the same time, and its frightening technology has made European and American enterprises tremble
搜素专题(DFS )
小满网络模型&http1-http2 &浏览器缓存
Reptile practice (V): climbing watercress top250
GPS从入门到放弃(十九)、精密星历(sp3格式)
基于LM317的可调直流电源
用aardio写一个旋转验证码标注小工具
Dialogue with Jia Yangqing, vice president of Alibaba: pursuing a big model is not a bad thing
【MySQL】Online DDL详解
随机推荐
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
What can one line of code do?
LeetCode学习记录(从新手村出发之杀不出新手村)----1
Kohana 数据库
string的底层实现
保存和检索字符串
JS method to stop foreach
小满网络模型&http1-http2 &浏览器缓存
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
Checkpoint of RDD in spark
Uni app app half screen continuous code scanning
Bat script learning (I)
50 commonly used numpy function explanations, parameters and usage examples
ViT论文详解
GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
Reset Mikrotik Routeros using netinstall
Intelligent online customer service system source code Gofly development log - 2 Develop command line applications
The golden age of the U.S. technology industry has ended, and there have been constant lamentations about chip sales and 30000 layoffs
Is it important to build the SEO foundation of the new website
What is the RDD operator in spark