当前位置:网站首页>Oracle view hard parsing
Oracle view hard parsing
2022-07-27 10:17:00 【Bass piano】
ORACLE Hard analytic analysis
Preface
In the work ORACLE The more you use it , Right ORACLE The less you know . Use now to find that for ORACLE Nothing more . tragedy . See today AWR When reporting, I saw hard parsing , By the way, I relearned the relevant knowledge points .
ORACLE Hard parsing and soft parsing of
stay ORACLE in , When executing a new SQL when , The general steps are as follows :
1、 Syntax check , If there is a mistake SQL The next steps will not be performed
2、 Semantic and permission checking , For example, inspection. SQL Objects in the ( surface 、 View etc. ) Whether there is , The current user is right SQL Whether there is Execution Authority
3、ORACLE Inside to SQL Perform parsing and optimization
4、 Generate an execution plan based on statistical information . This sentence actually solves some of my previous doubts , In this blog post, I won't discuss more
5、 Save cursor information to the library cache
6、 perform SQL And return the execution result
This is actually a hard parsing process , The reason is simple ,“ Carry out a new SQL”, It must be hard parsing . Among them the SQL Parsing and generating execution plans are the most time-consuming steps , But I didn't verify it myself , Refer to official documents and online materials .
Soft parsing , In fact, I skipped SQL The steps of parsing and generating the execution plan
Mistake 1 : As long as there is hard parsing, it is a program problem . This is not necessarily ,ORACLE11g The version of has a BUG, It will lead to something that could have been soft parsed SQL However, hard parsing is performed ,BUG The number is as follows :
Bug:9689310:
- Non sharability of cursors due to BIND_MISMATCH.
Bug:6981690:- Non sharability of cursors due to PQ_SLAVE_MISMATCH
Bug:8981059:- Non sharability of cursors due to USER_BIND_PEEK_MISMATCH.
stay https://support.oracle.com/portal/ You can query the corresponding BUG The existing version .
Mistake 2 : As long as binding variables are used , It must not be hard to parse . Not necessarily , There are many problems leading to hard parsing , see v$sql_shared_cursor View will know , Each column in this view represents a reason for hard parsing . therefore , The main method to solve hard parsing is to use bound variables , But using bound variables is not necessarily soft parsing .
AWR Hard parsing in the report
It involves the production environment , Can't put the complete AWR Send the report , You can only send screenshots after processing , I'm sorry 
AWR Show in report hard parses Per second 18.7 individual , There is information that this value cannot exceed 20, I don't think this standard is so rigid , For example, I AWR The reporting interval is 7 God , Every second 18.7 The second hard analysis is still terrifying . Only the configuration of the server is good enough X, therefore DB TIME It looks normal . The cow of the server cannot be used SQL Reasons for not optimizing
adopt ORACLE View judgment hard parsing
AWR Only hard parsing can be seen in the report , But I can't see hard parsed statements , So use v$sqlarea and v$sql_shared_cursor To judge .
First execute the following statement , Filter out those with significantly higher parsing times SQL:
SELECT S.SQL_ID, S.SQL_FULLTEXT,S.VERSION_COUNT ,S.LAST_LOAD_TIME FROM v$sqlarea S ORDER BY S.VERSION_COUNT DESC;
Sorry, I won't put the screenshot because it's a production environment . There will be four columns in the query results , Namely SQL_ID, SQL_FULLTEXT, VERSION_COUNT, LAST_LOAD_TIME, among VERSION_COUNT Is the number of parsing . Note that multiple parsing is not necessarily hard parsing , Find the corresponding SQL_ID, Then use the following SQL Inquire about :
SELECT * FROM v$sql_shared_cursor c where c.sql_id = '[SQL_ID]'
v$sql_shared_cursor The reason for hard parsing can be seen in the view , From the fourth column to the last column in this view , Each column represents a kind of reason that leads to hard parsing , Value has Y|N, If it is Y, It shows that the corresponding reason of this column leads to hard parsing , For example, in the query result, if BIND_EQUIV_FAILURE The value of is Y, The reason is that BIND_EQUIV_FAILURE, Then we can confirm this SQL It must be hard parsing , If there are many parsing times , But the results of this query are N, Then the reason why it queries many times is not hard parsing , Maybe for some other reason ., If you think my view is incorrect , Comments are welcome , There are a total of 320 Column , That is to say ORACLE There will be 320 There are three reasons for hard parsing , I took a closer look at this 320 Column , Finally, I found that I couldn't understand a column ... Um. ……GOOD. That's why I said at the beginning , use ORACLE The longer it takes , Find yourself knowing less .
Hard analysis of specific reasons, at my current level, I can't do a very detailed explanation , In the future, I will continue to add . There are many on the Internet from ORACLE The form excerpted from the official website , But there is no further explanation and analysis , I won't copy this form .
About version count
When SQL The first time a statement is executed , In hard parsing , Will create parent cursor and child cursor. this 2 It's a must . this 2 This process costs more resources . It is also the main thing in hard parsing . When you execute this again SQL when ,Oracle Will be right first SQL The sentence goes on hash operation , Produce a hash value , Then use this HASH It's worth it buckets Go to find ,hash value Store in parent cursor in . If you find it , I'll check it out child cursor. If you can reuse this child cursor, So call it directly cursor The implementation plan of the project . If it is not reusable , I'm going to create a new one child cursor. This child cursor The number of , Namely version count. Different parent cursor Corresponding child cursor The more ,version count The higher
边栏推荐
- 线代004
- Qt 学习(二) —— Qt Creator简单介绍
- oracle rac 19c pdb实例当掉
- 3D人脸重建:Joint 3D Face Reconstruction and Dense Alignment with position Map Regression Network
- Decision tree principle and case application - Titanic survival prediction
- QT learning (II) -.Pro file explanation
- 声音处理之-梅尔频率倒谱系数(MFCC)
- FTP 服务器
- Live countdown 3 days sofachannel 29 P2P based file and image acceleration system Dragonfly
- Shell流程控制(重点)、if 判断、case 语句、let用法、for 循环中有for (( 初始值;循环控制条件;变量变化 ))和for 变量 in 值 1 值 2 值 3… 、while 循环
猜你喜欢

wind10配置adb命令

Leetcode.814. binary tree pruning____ DFS

Anaconda installation (very detailed)

pytorch的安装(非常详细)

Based on LSM tree idea Net 6.0 C # write a kV database (case version)

StyleGAN论文笔记+修改代码尝试3D点云生成

线代004

Food safety | the more you eat junk food, the more you want to eat it? Please keep this common food calorimeter

Robotframework+eclispe environment installation

window平台下本地连接远程服务器数据库(一)
随机推荐
Pygame: alien invasion
【精选】如何完美的写 PHP 代码的呢?
Food safety | the kitchen board environment is very important. Do you know these use details?
sql注入
Leetcode.814. binary tree pruning____ DFS
hdu5288(OO’s Sequence)
备战金九银十Android面试准备(含面试全流程,面试准备工作面试题和资料等)
DCGAN论文改进之处+简化代码
Based on LSM tree idea Net 6.0 C # write a kV database (case version)
QT learning (II) -- a brief introduction to QT Creator
语音数据采集-实时语音数据可视化
How does data analysis solve business problems? Here is a super detailed introduction
Overview of PCL modules (1.6)
Anchor free detector: centernet
Shell integrated application cases, archiving files, sending messages
Leetcode.565. array nesting____ Violent dfs- > pruning dfs- > in situ modification
hdu5289(Assignment)
pytorch中对BatchNorm2d()函数的理解
Vs2019 Community Edition Download tutorial (detailed)
When I went to oppo for an interview, I got numb