当前位置:网站首页>MySQL storage system
MySQL storage system
2022-06-30 05:53:00 【Sxiny Xin】
Catalog
One 、 Storage engine
MySQL The data in is stored in files with various technologies , Each technology uses a different storage mechanism 、 Indexing techniques 、 Lock levels and ultimately provide different functions and capabilities , These different technologies and supporting functions are in MySQL It's called storage engine in , The storage engine is MyISAM、InnoDB MySQL Components in the database , Responsible for executing the actual data l/0 operation MySQL In the system , The storage engine is on top of the file system , The data is transferred to the storage engine before it is saved to the data file , Then, it is stored according to the storage format of each storage engine .
Two 、MyISAM And Innodb
2.1MyISAM
MyISAM Table supported 3 Different storage formats
static state ( Fixed length ) surface :
Static tables are the default storage format . Fields in static tables are immutable , So every record is a fixed length , The advantage of this storage method is that the storage is very fast , Easy to cache , It's easy to recover in case of failure ; The disadvantage is that it usually takes up more space than a dynamic table .
Dynamic table :
Dynamic tables contain variable fields , Records are not fixed length , The advantage of this storage is that it takes up less space , But frequent updates 、 Deleting records will cause fragmentation , It needs to be carried out on a regular basis OPTIMIZE TABLE Sentence or myisamchk -r Command to improve performance , And it's relatively difficult to recover in case of failure .
Compression meter :
The compressed table consists of myisamchk Tool creation , Take up a very small space , Because each record is compressed separately , So there's only a very small cost of access .
MyISAM Production scenarios used
MyISAM Advantages and disadvantages
MyISAM It's table level locking , Reading or writing cannot be done at the same time
The advantage is : When executed separately , Fast 、 Relatively few resources are occupied ( relative )
2.2Innodb
Innodb characteristic :
1. Support things , Support 4 Isolation level of things
2.MySQL from 5.5.5 Version start , The default storage engine is Innodb,5.5 It used to be myisam(isam) Default
3. Read / write blocking is related to the isolation level of things
4. It can cache index and data very efficiently
5. Tables and primary keys are stored in clusters
6. Support partition 、 Table space , similar oracle database (5.5----》5.6 and 5.7 Third generation database 8.0 Later version )
7. Support for foreign key constraints ,5.5 Full text indexing is not supported before ,5.5 Full text index is supported after
8. The requirement for hardware resources is relatively high
9. Row level locking , But full table scanning will still be table level locking
2.3MyISAM And Innodb difference
MyISAM Do not support things , Foreign key constraints are not supported either , Full text indexing only , Data files and index files are kept separately ; Fast access , There is no requirement for transaction integrity , Suitable for inquiry 、 Insert the main application scenario
Innodb Support things , Support 4 Isolation level of things , Support the index , Support for foreign key constraints
3、 ... and 、 Control statement
3.1 Check out the storage engines supported by the system
show engines;
3.2 Look at the storage engine that the table uses
Method 1 :
show table status from Library name where name=‘ Table name ’\G;

Method 2 :
use Library name ;
show create table Table name ;
3.3 Modify the storage engine
Method 1 :
use Library name ;
alter table Table name engine=MyISAM;
Method 2 :
vim /etc/my.cnf
…
[mysqld]
…
default-storage-engine=INNODB
systemctl restart mysqld

This method only changes the configuration file and restarts mysql The newly created table is valid after service , The existing table will not be changed . Create a new table to view 

Method 3 :
adopt create table Specify the storage engine when creating the table
create table Table name ( Field 1 data type ,…)engine=Innodb;
边栏推荐
- Solidy - fallback function - 2 trigger execution modes
- inno setup 最简单的自定义界面效果
- STM32F103 series controlled OLED IIC 4-pin
- 【板栗糖GIS】global mapper—如何把栅格的高程值赋予给点
- Xctf attack and defense world crypto advanced area
- Leetcode56. consolidation interval
- Inno setup the simplest user-defined interface effect
- Delete the repeating elements in the sorting list (simple questions)
- [chestnut sugar GIS] global mapper - how to assign the elevation value of the grid to the point
- Sound network, standing in the "soil" of the Internet of things
猜你喜欢

声网,站在物联网的“土壤”里
![[deep learning] data segmentation](/img/16/798881bbee66faa2fb8d9396155010.jpg)
[deep learning] data segmentation

About modifying dual system default startup item settings

STM32F103系列控制的OLED IIC 4针

How to create a CSR (certificate signing request) file?

English语法_形容词/副词3级-最高级

MySQL advanced (Advanced SQL statement)

Summary of redis learning notes (I)

Database SQL language 03 sorting and paging

Xctf attack and defense world crypto advanced area
随机推荐
Promise知识点拾遗
Sound network, standing in the "soil" of the Internet of things
inno setup 最简单的自定义界面效果
Sound net, debout dans le "sol" de l'IOT
token 过期后,如何自动续期?
动态规划--怪盗基德的滑翔翼
如何制作CSR(Certificate Signing Request)文件?
Force deduction exercise -- deleting repeated items in ordered sequence 1.0
Database SQL language 03 sorting and paging
UML tools
Turn off automatic outlining in Visual Studio - turning off automatic outlining in Visual Studio
Learning about functions QAQ
We strongly recommend more than a dozen necessary plug-ins for idea development
Summary of redis learning notes (I)
[ansible series] fundamentals -01
Implementation of property management system with ssm+ wechat applet
Xiaosha's lunch
Rotating frame target detection mmrotate v0.3.1 learning configuration
How to automatically renew a token after it expires?
云服务器部署 Web 项目