当前位置:网站首页>MySQL architecture
MySQL architecture
2022-06-24 01:34:00 【Xiao Wange】
mysql8.0 Architecture
Look at the picture mysql Service is a c/s framework It is to use c and c++ Developed
Connectors End
Can pass , Various clients , link mysql The server Such as mysql command , Various apl etc.
server End
It is divided into many modules
Link layer
1 Provide link agreement TCP/IP The local socket
2 User name password verification ( The authentication database through the authorization table is started , The authorization table will be loaded into memory mysql.user mysql.db mysql.table_priv mysql.column_priv)
3 Provide link thread
View linked threads show processlist;
View all threads in the background select * from performance_schema.threads\G
sql layer
sql Thread receiving link thread
Preprocessing (lex) grammar , semantics ( What kind of statements are ), jurisdiction ( Do you have permission to access the library or table ) Check
analysis (yacc) Generate parse tree (ast Abstract syntax tree )
Optimize Logic optimization Equivalent transformation based on relational algebra , In physical optimization Refer to statistics ( It describes , The distribution of data , Some status of the index , Roughly record how many lines there are in the table ) And some optimizer algorithms , Cost assessment , Generate execution plan (explain)
Description of Statistics The statistics record The state of the table , Table name data row Data distribution Index status information ... The statistics are mysql Collected regularly Through some parameter indexes Not collected in real time mysql.innodb_index_stats mysql.innodb_table_stats # problem One sql The statement ran well yesterday (0.01 second ) , Suddenly it slows down (2min)? Why? Due to inaccurate statistical information , It is caused by not going through the index You can force a re collection by command There is also parameter control analyze teble Library name . Table name ; perhaps optimize table Library name . Table name ; # Command lock table Use caution
Engine layer
io Thread receive sql Threads
mysql Dealing with disks is similar to linux File system
innodb Storage engine is divided into memory structure and disk structure
Macro structure of storage
stay mysql In a database , It is a directory in the system
stay mysql One of the tables Corresponds to one of the operating systems .ibd file (8.0)
In the operating system, you can use ibd2sdi file name You can view the files
In the table data row + Metadata ( Table properties , Columns of the table ( Column properties ), Table name ) mysql8.0 How tables are stored The data of each table is stored in ibd In file mysql5.7 How tables are stored data row ibd file Source data frm +ibdata1( The overall ) file Online DDL It will be faster
8.0 New features understanding
metdata Structural changes 5.7 Version of the problem Two sets of data dictionary information server layer .frm innodb The data dictionary DDL Unable to atomize ( When deleting two tables , Not together ) frm and innodb Layers will be inconsistent Concurrency needs to be handled with care (MDL,dict_sys::mutex,dict_sys::rw_lock) The crash cannot be recovered 8.0 New characteristics Support transactional DDL, Crash can be rolled back , To ensure consistency , Keep only one copy of the data dictionary information , To cancel the frm The data dictionary The data is all in the InnoDB In the table Adopt sleeve locking mechanism , Manage concurrent access to data dictionaries (DML) all-new plugin Support 8.0.17 Then add clone plugin, Better support MGR InnoDB Clustre Node management of The secure encryption method changes Change the encryption method to caching_sha2_password SSL Will support to TLSv1.3 edition . Changes in user management and authentication methods Change the authorization method Join in role Role permissions Add more permissions cache&&Buffer The change of To cancel the Query Cache The result of the query is cached You will make a query statement hash The result is key If you add the query criteria The cache will not hit mysql The query cache for is not a cache execution plan , It's a query and its result set , This means that only the same query operation can hit the cache , hide mysql The query hit rate is very low oracle What is cached is the execution plan Reduce understanding of the process .
mysql example
mysqld Daemon + Master Threa + Worker Threads + Pre allocated memory
mysql Memory structure global buffers( overall situation ) innodb_buffer_pool( You can set the physical memory %50-%75): Data buffer innodb_log_buffer: Log buffer key_buffer table_cache session buffers( Each session is used independently ) read_buffer read_fnd_buffer sort buffer join buffer tmp table binlog_cache
mysql Thread in master thread Function as the core background process , Responsible for global management data refresh and data consistency processing io thread Responsible and disk io Interaction (read io write io insert buffer log io) Related parameters inndbo_read_io_threads, inndbo_write_io_threads Purge thread effect UNDO Page recycling Parameters innodb_purge_threads page cleaner effect Dirty page refresh thread Default 1 Maximum 64 Parameters innodb_page_cleaners other threads
边栏推荐
- S2b2c e-commerce platform in the pharmaceutical and medical industry enables enterprises to grasp differentiated competitive advantages and improve supply chain efficiency
- Coordinate system "slang" in GIS world
- jdbc
- [technical grass planting] take you to Tencent cloud's private cloud disk in ten minutes
- Openstack
- Selenium crawls stocks in practice
- What is the website domain name trademark registration process? What is the use of a website domain name trademark?
- Tencent cloud recruitment order sincerely invites ISV partners for customized development!
- What is pension finance? What are the pension financial products?
- Go language core 36 lectures (go language practice and application VII) -- learning notes
猜你喜欢
随机推荐
Feasibility of importing UE4 using gltf with instances
什麼是養老理財?養老理財產品有哪些?
Sockfwd a data forwarding gadget
What is the relationship between the Internet of things and artificial intelligence?
How to make a fixed asset identification card
Leetcode lecture on algorithm interview for large factories 2 Time space complexity
Flink weapon: introduction to the open source platform streamx
Dart series: using packages in dart
How to quickly convert stock code into int in quantitative trading?
Tke cluster setup linkerd2
[solution] how to realize AI automatic recognition of high altitude parabolic behavior?
NJS triggers system command operation
2021-11-19:[0,4,7]:0 means that the stone here has no color. If it turns red
[technical grass planting] take you to Tencent cloud's private cloud disk in ten minutes
Radware load balancer common maintenance query commands
Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
DCOM horizontal movement of Intranet penetration
Moment. JS how to get the zero hour time of the current time
Gin framework: implementing distributed log tracing
Textplus - reverse engineering of textplus

![[flutter] comment utiliser les paquets et plug - ins flutter](/img/a6/e494dcdb2d3830b6d6c24d0ee05af2.png)