当前位置:网站首页>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;
边栏推荐
- 电脑查看WiFi使用密码
- 8 ways to earn passive income
- Codeforces Round #390 (Div. 2) D. Fedor and coupons
- Leader: who can use redis expired monitoring to close orders and get out of here!
- leetcode763. Divide letter interval
- Luogup2756 pilot pairing scheme problem (maximum flow)
- C语言基础小操作
- 1380. lucky numbers in matrices
- AI大模型落地大考,浪潮交出了怎样的答卷?
- Switch to software testing and report to the training class for 3 months. It's a high paying job. Is it reliable?
猜你喜欢

Codeforces C. Andrew and Stones

Using lazy < t > in C # to realize singleton mode in WPF

电脑查看WiFi使用密码

Huxiaochun came to fengshu electronics to sign a strategic cooperation agreement with Zoomlion

STM32F103系列控制的OLED IIC 4针

What are membrane stress and membrane strain

What do you think of the deleted chat records? How to restore the deleted chat records on wechat?

Codeforces B. MEX and Array
![[GPU] basic operation of GPU (I)](/img/ce/0ca8c63525038fea64c40aabd17fc6.jpg)
[GPU] basic operation of GPU (I)

Why can transformer break into the CV world and kill CNN?
随机推荐
Rotating frame target detection mmrotate v0.3.1 learning configuration
AI大模型落地大考,浪潮交出了怎样的答卷?
Database SQL language 03 sorting and paging
MySQL日志管理、数据备份、恢复
InputStream转InputStreamSource
Xctf attack and defense world crypto advanced area
Rotating box target detection mmrotate v0.3.1 getting started
Xi'an Jiaotong 21st autumn online expansion resources of online trade and marketing (III) [standard answer]
Shopping list--
Solitidy - fallback 回退函数 - 2种触发执行方式
旋转框目标检测mmrotate v0.3.1 训练DOTA数据集(二)
Redistemplate common method summary
Array pointers and pointer arrays
Learning about functions QAQ
10-【istio】istio Sidecar
How does WPS cancel automatic numbering? Four options
Solidity - 安全 - 重入攻击(Reentrancy)
MySQL advanced (Advanced SQL statement)
[ansible series] fundamentals -01
/Path/to/ idiom, not a command