当前位置:网站首页>MySQL real battle optimization expert 11 starts with the addition, deletion and modification of data. Review the status of buffer pool in the database
MySQL real battle optimization expert 11 starts with the addition, deletion and modification of data. Review the status of buffer pool in the database
2022-07-06 10:06:00 【Office template library material frog】
1、 Everything starts with the addition, deletion and modification of data
Okay , Until now , In fact, we have made a preliminary explanation MySQL Overall architecture design principle of , Everyone for MySQL What components are included inside , We usually update data and query data , Roughly how to do it , Have a relatively high-level understanding .
In addition, now we have a preliminary understanding MySQL After the architectural principle of , We also introduced some production experience related to our database , Is for any one project , Databases need to choose the right machine , At the same time, make pressure measurement , And there is a perfect visual monitoring system .
Now it can be understood that everyone has an available database , And I have a certain understanding of the overall architecture principle of the database . So next , We This column has 100 More content , Then, of course, we will explain all aspects of the database in detail
Which link should we start with ?
Of course, it starts with the addition, deletion and modification of the database , Because when you have a database in hand , You must develop a system , The system is directly based on the database Various operations of adding, deleting, modifying and querying , Implement various business logic
And when any system uses a database , It must start with inserting data , That is, first of all, we will add, delete and modify the data .
When you have data in your database , Then various query operations will be performed .
So the explanation order of our column , Just as you have a pressure tested 、 After having a perfect monitoring database , The system you developed uses the order of databases to Explain , First, explain the insider principle behind the system's various operations of adding, deleting and modifying databases , And the principle of affairs , Including the underlying mechanism of locks , Then explain that you have After the data , When performing various complex query operations , The underlying principles of indexing involved , The underlying principle of query optimization .
Of course, we will be interspersed with various cases of production practice , Just as I explained before 《 from 0 Start taking you to be JVM Real world Master 》 Like a column .
Then after explaining these , Let's talk about how we usually develop systems , How to model the database , When modeling the database , How to note Meaning field type 、 Some problems of index type , How to ensure that the database avoids deadlock 、 High performance operation .
Then we will explain some high-level database architecture design , For example, master-slave architecture design and sub database and sub table architecture design , Including some cases of production practice .
So these are the order that we will explain in the next column , I want to inform you in advance , In the process of actual explanation , It will increase a lot Rong , For example, the next few talks are in-depth analysis Buffer Pool The content of , In fact, there is nothing in the original outline .
In addition, in the process of my next explanation , The order of the original contents of the outline may also be adjusted at any time , For example, after I explain Buffer Pool after , And then maybe Will explain in depth directly redo log、undo log、binlog These mechanisms , At the same time, we will explain the transaction mechanism , Locking mechanism , Underlying data storage mechanism .
Then after all this is said , Is to explain the content of indexing and query optimization , So I hope you can understand that we will make additional additions to the outline at any time , And me We will adjust the order of the outline content at any time .
good , Then start with this article , Let's explore various underlying mechanisms and production practice cases of databases !
2、 Take a look back. Buffer Pool What is it ?
Now let's review the Buffer Pool What is it ? In fact, it is a very critical component , Because we all know through the previous explanation One o'clock , That is, the data in the database is actually ultimately stored on disk files , As shown in the figure below .
But when we add, delete and modify the database , It is impossible to update the data on the disk directly , Because if you do random read and write to the disk , That speed It's quite slow , Random reading and writing of any large disk file , It may take hundreds of milliseconds . If you do that , Maybe your database can only Hundreds of requests have been processed !
We have explained it before , When you are adding, deleting or modifying the database , In fact, it is mainly for the memory Buffer Pool The data in , also In fact, you mainly add, delete and modify the data structure in the memory of the database , As shown in the figure below .
Of course , We have said before , In fact, everyone is worried about one thing , That is, you perform a lot of adding, deleting and modifying operations in the memory of the database , Memory data is updated , But at this time, if the database suddenly crashes , Then the updated data in the memory is gone ?
So in fact, we spent a lot of space on this issue at the beginning ,MySQL Afraid of this problem , So we introduced a redo log Mechanism , You are in the memory When adding, deleting and modifying data , At the same time, he will write the log corresponding to the addition, deletion and modification to redo log in , Here's the picture .
In case your database suddenly crashes , No problem , As long as redo log Read out what additions, deletions and modifications you have done before in the log file , You can put this again in an instant Some additions, deletions and modifications are performed in your memory , This will restore what additions, deletions and modifications you have done before .
Of course, for the process of data update , He has a strict set of steps , Also involves undo log、binlog、 Commit transaction 、buffer pool Dirty data brush back disc , wait . We have talked about it before , I won't repeat it here , Just take you back to the database Buffer Pool This thing .
3、Buffer Pool In one sentence
So here we are simply right Buffer Pool Make a summary of this thing , In fact, it is the first core component in the database that we must understand , Because adding, deleting, and changing operations The first thing to do is to target the Buffer Pool The data in the is executed , At the same time, it cooperates with the follow-up redo log、 Brush disk and other mechanisms and operations .
therefore Buffer Pool Is a memory component of the database , It caches the real data on the disk , And then our Java The addition, deletion and modification of the database performed by the system do , In fact, it is mainly executed on the cached data in the memory data structure .
In this article, we first discuss Buffer Pool Make a simple review of the positioning of this thing , In the next article, let's analyze Buffer Pool This memory data node What is included in the structure .
边栏推荐
- C杂讲 文件 续讲
- A new understanding of RMAN retention policy recovery window
- C miscellaneous two-way circular linked list
- 软件测试工程师发展规划路线
- Which is the better prospect for mechanical engineer or Electrical Engineer?
- 在CANoe中通过Panel面板控制Test Module 运行(初级)
- MySQL ERROR 1040: Too many connections
- If someone asks you about the consistency of database cache, send this article directly to him
- Cooperative development in embedded -- function pointer
- A necessary soft skill for Software Test Engineers: structured thinking
猜你喜欢
Popularization of security knowledge - twelve moves to protect mobile phones from network attacks
Defensive C language programming in embedded development
CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
51单片机进修的一些感悟
Download address of canoe, download and activation of can demo 16, and appendix of all canoe software versions
13 医疗挂号系统_【 微信登录】
Some thoughts on the study of 51 single chip microcomputer
Preliminary introduction to C miscellaneous lecture document
西南大学:胡航-关于学习行为和学习效果分析
随机推荐
嵌入式開發中的防禦性C語言編程
14 medical registration system_ [Alibaba cloud OSS, user authentication and patient]
AI的路线和资源
Control the operation of the test module through the panel in canoe (Advanced)
Upload vulnerability
[untitled]
Safety notes
Vh6501 Learning Series
History of object recognition
学习单片机对社会的帮助是很大的
C杂讲 浅拷贝 与 深拷贝
Competition vscode Configuration Guide
Learning SCM is of great help to society
[NLP] bert4vec: a sentence vector generation tool based on pre training
Popularization of security knowledge - twelve moves to protect mobile phones from network attacks
C杂讲 文件 续讲
Why is 51+ assembly in college SCM class? Why not come directly to STM32
Write your own CPU Chapter 10 - learning notes
Regular expressions are actually very simple
CAPL 脚本对.ini 配置文件的高阶操作