当前位置:网站首页>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
边栏推荐
- Metaaploit-后渗透技知识
- 卸载CUDA11.1
- 如何创建一个带诊断工具的.NET镜像
- 数据分析如何解决商业问题?这里有份超详细攻略
- es6 class 继承的重点
- Leetcode.565. array nesting____ Violent dfs- > pruning dfs- > in situ modification
- Gbase 8A MPP cluster capacity expansion practice
- Concurrent thread state transition
- Summary of binary tree exercises
- Understanding of batchnorm2d() function in pytorch
猜你喜欢

Stylegan paper notes + modify code to try 3D point cloud generation

Visual slam lecture notes (I): Lecture 1 + Lecture 2

直播倒计时 3 天|SOFAChannel#29 基于 P2P 的文件和镜像加速系统 Dragonfly

wind10配置adb命令

Xiandai 003

Understanding of batchnorm2d() function in pytorch

vs2019社区版下载教程(详细)

StyleGAN论文笔记+修改代码尝试3D点云生成
![Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数](/img/3d/d7276d2010f1d77a3bd572cc66eced.png)
Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数
![Text processing tool in shell, cut [option parameter] filename Description: the default separator is the built-in variable of tab, awk [option parameter] '/pattern1/{action1}filename and awk](/img/ed/941276a15d1c4ab67d397fb3286022.png)
Text processing tool in shell, cut [option parameter] filename Description: the default separator is the built-in variable of tab, awk [option parameter] '/pattern1/{action1}filename and awk
随机推荐
Color segmentation using kmeans clustering
DCGAN论文改进之处+简化代码
数据分析如何解决商业问题?这里有份超详细攻略
hdu5288(OO’s Sequence)
Shell function, system function, basename [string / pathname] [suffix] can be understood as taking the file name in the path, dirname file absolute path, and user-defined function
Leetcode.814. binary tree pruning____ DFS
Text processing tool in shell, cut [option parameter] filename Description: the default separator is the built-in variable of tab, awk [option parameter] '/pattern1/{action1}filename and awk
Anaconda安装(非常详细)
3D修复论文:Shape Inpainting using 3D Generative Adversarial Network and Recurrent Convolutional Networks
超赞的卡尔曼滤波详解文章
文件上传漏洞相关
ORACLE 11g手动内存管理
安装CUDA失败的情况nsight visual studio edition失败
StyleGAN论文笔记+修改代码尝试3D点云生成
Shell变量、系统预定义变量$HOME、$PWD、$SHELL、$USER、自定义变量、特殊变量$n、$#、$*、[email protected]、$?、env看所有的全局变量值、set看所有变量
Matlab绘制不同阻尼下的系统响应
Failure of CUDA installation nsight visual studio edition failed
Food safety | the more you eat junk food, the more you want to eat it? Please keep this common food calorimeter
数据库操作基础语句
Concurrent thread state transition