Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Simple Analysis of MySQL Architecture

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the knowledge of "simple Analysis of MySQL Architecture". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

To understand MySql, you must keep its architecture diagram in mind. Mysql is composed of SQL interface, parser, optimizer, cache, and storage engine.

1 Connectors refers to interaction with SQL in different languages

2 Management Serveices & Utilities: a system management and control tool

3 Connection Pool: connection pool.

Manage caching requirements such as buffering user connections, threading, etc.

4 SQL Interface: SQL API.

Accept the user's SQL command and return the results that the user needs to query. For example, select from calls SQL Interface.

5 Parser: parser.

The SQL command is validated and parsed by the parser when it is passed to the parser. The parser is implemented by Lex and YACC and is a long script.

Main functions:

A. Decompose the SQL statement into a data structure and pass this structure to the next step, based on which the delivery and processing of the SQL statement is based

b. If an error is encountered in the decomposition composition, then the sql statement is unreasonable.

6 Optimizer: query optimizer.

The SQL statement uses the query optimizer to optimize the query before the query. He uses the "select-project-join" strategy to query.

It can be understood by an example: select uid,name from user where gender = 1

This select query is selected according to the where statement first, rather than querying all the tables first and then gender filtering.

This select query first projects attributes based on uid and name, rather than taking out all the attributes and then filtering them.

Join the two query conditions together to generate the final query result

7 Cache and Buffer: query cache.

If the query cache has a hit query result, the query statement can directly fetch data from the query cache.

This caching mechanism consists of a series of small caches. Such as table cache, record cache, key cache, permission cache, etc.

8 Engine: storage engine.

Storage engine is a specific subsystem dealing with files in MySql. It is also one of the most distinctive features of Mysql.

Mysql's storage engine is plug-in. It customizes a file access mechanism based on an abstract interface of the file access layer provided by MySql AB (this access mechanism is called storage engine).

Now there are many kinds of storage engines, each of which has different advantages, the most commonly used is MyISAM,InnoDB,BDB

By default, MySql uses the MyISAM engine, which has fast query speed, good index optimization and data compression technology. But it does not support transactions.

InnoDB supports transactions, provides row-level locking, and is widely used.

Mysql also supports its own customized storage engine, and even different tables in a library use different storage engines, which are allowed.

This is the end of "A simple Analysis of MySQL Architecture". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report