当前位置:网站首页>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;
边栏推荐
- SSL证书续费相关问题详解
- What indicators should safety service engineers pay attention to in emergency response?
- Leetcode search insert location
- Xctf attack and defense world crypto advanced area
- Learning about functions QAQ
- AI大模型落地大考,浪潮交出了怎样的答卷?
- Finally someone can make the server so straightforward
- 从零开发 stylelint规则(插件)
- 动态规划--怪盗基德的滑翔翼
- Video summary of my station B
猜你喜欢

【板栗糖GIS】global mapper—如何把栅格的高程值赋予给点

8 ways to earn passive income

从零开发 stylelint规则(插件)

Basic operations of C language

After getting these performance test decomposition operations, your test path will be more smooth

token 过期后,如何自动续期?

Redistemplate common method summary

At the age of 32, I fell into a middle-aged crisis and finally quit naked...

How does WPS cancel automatic numbering? Four options

强烈推荐十几款IDEA开发必备的插件
随机推荐
The definition of strain was originally from stretch_ Ratio started
剑指 Offer 22. 链表中倒数第k个节点
超简单 STM32 RTC闹钟 时钟配置
Database SQL language 05 SQL exercise
二十四、输入输出设备模型(串口/键盘/磁盘/打印机/总线/中断控制器/DMA和GPU)
雲服務器部署 Web 項目
Switch to software testing and report to the training class for 3 months. It's a high paying job. Is it reliable?
UE4_ Editor UMG close window cannot destroy UMG immediately
/Path/to/ idiom, not a command
InputStream转InputStreamSource
Vfpbs uploads excel and saves MSSQL to the database
Learning automation ppt
How to create a CSR (certificate signing request) file?
What indicators should safety service engineers pay attention to in emergency response?
Set of XXL job principles
UE4_ Editor development: highlight the UI making method according to the assets dragged by the mouse (1)
Detailed explanation of issues related to SSL certificate renewal
Xijiao 21 autumn "motor and drive" online homework answer sheet (III) [standard answer]
hashlips_ art_ Engine-1.0.6 usage
Sound net, debout dans le "sol" de l'IOT