当前位置:网站首页>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
边栏推荐
- samba服务器
- 活体检测综述
- Pytorch installation (very detailed)
- Matlab- draw superimposed ladder diagram and line diagram
- Leetcode.565. array nesting____ Violent dfs- > pruning dfs- > in situ modification
- 超赞的卡尔曼滤波详解文章
- Introduction to regular expressions of shell, general matching, special characters: ^, $,., * Character range (brackets): [], special characters: \, matching mobile phone number
- Switch port mirroring Configuration Guide
- 语音数据采集-实时语音数据可视化
- Xiandai 003
猜你喜欢

Switch port mirroring Configuration Guide

Anchor free detector: centernet

Overview of PCL modules (1.6)

samba服务器
[email protected], "/>Shell variables, system predefined variables $home, $pwd, $shell, $user, custom variables, special variables $n, $, $*, [email protected],

Live countdown 3 days sofachannel 29 P2P based file and image acceleration system Dragonfly

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

文件上传漏洞绕过方法

Oracle调整数据文件大小杂谈

Shell process control (emphasis), if judgment, case statement, let usage, for ((initial value; loop control condition; variable change)) and for variable in value 1 value 2 value 3..., while loop
随机推荐
Leetcode.814. binary tree pruning____ DFS
Oracle调整数据文件大小杂谈
ACL2021最佳论文出炉,来自字节跳动
线代003
Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号
QT learning (II) -.Pro file explanation
Decision tree principle and case application - Titanic survival prediction
Introduction to Matlab real time editor
Mathematical reasoning: five couples get together and shake hands when they meet
Shell的read 读取控制台输入、read的使用
数学推理题:张王李赵陈五对夫妇聚会,见面握手
NVIDIA geforce experience login error: the verifier failed to load. Please check your browser settings, such as the advertisement interceptor (solution)
Anchor Free检测器:CenterNet
Pytorch installation (very detailed)
WGAN、WGAN-GP、BigGAN
程序的翻译和执行,从编辑、预处理、编译、汇编、链接到执行
Discussion on a problem
Simple use of tflite
Snowflake vs. Databricks谁更胜一筹?2022年最新战报
Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数