当前位置:网站首页>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 .
边栏推荐
- 安装OpenCV时遇到的几种错误
- MySQL combat optimization expert 03 uses a data update process to preliminarily understand the architecture design of InnoDB storage engine
- C杂讲 文件 续讲
- Function description of shell command parser
- A new understanding of RMAN retention policy recovery window
- Constants and pointers
- CANoe的数据回放(Replay Block),还是要结合CAPL脚本才能说的明白
- Several silly built-in functions about relative path / absolute path operation in CAPL script
- 通过bat脚本配置系统环境变量
- [flask] crud addition and query operation of data
猜你喜欢

MySQL实战优化高手04 借着更新语句在InnoDB存储引擎中的执行流程,聊聊binlog是什么?

CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?

软件测试工程师必备之软技能:结构化思维

Keep these four requirements in mind when learning single chip microcomputer with zero foundation and avoid detours
![[NLP] bert4vec: a sentence vector generation tool based on pre training](/img/fd/8e5e1577b4a6ccc06e29350a1113ed.jpg)
[NLP] bert4vec: a sentence vector generation tool based on pre training

Listen to my advice and learn according to this embedded curriculum content and curriculum system

再有人问你数据库缓存一致性的问题,直接把这篇文章发给他

What should the redis cluster solution do? What are the plans?
![14 medical registration system_ [Alibaba cloud OSS, user authentication and patient]](/img/c4/81f00c8b7037b5fb4c5df4d2aa7571.png)
14 medical registration system_ [Alibaba cloud OSS, user authentication and patient]

I2C summary (single host and multi host)
随机推荐
在CANoe中通过Panel面板控制Test Module 运行(初级)
[NLP] bert4vec: a sentence vector generation tool based on pre training
Elk project monitoring platform deployment + deployment of detailed use (II)
Random notes
Programmation défensive en langage C dans le développement intégré
[one click] it only takes 30s to build a blog with one click - QT graphical tool
cmooc互联网+教育
16 medical registration system_ [order by appointment]
Pointer learning
美疾控中心:美国李斯特菌疫情暴发与冰激凌产品有关
14 medical registration system_ [Alibaba cloud OSS, user authentication and patient]
Control the operation of the test module through the panel in canoe (Advanced)
Sichuan cloud education and double teacher model
MySQL實戰優化高手08 生產經驗:在數據庫的壓測過程中,如何360度無死角觀察機器性能?
Tianmu MVC audit II
软件测试工程师必备之软技能:结构化思维
17 医疗挂号系统_【微信支付】
软件测试工程师必备之软技能:结构化思维
[CV] target detection: derivation of common terms and map evaluation indicators
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?