Article Directory
- 5 MySQL Architecture
- 5.1 MyISAM
- 5.2 Innodb
- 5.2.1 How to choose between system table space and independent table space
- 5.2.2 Features of Innodb storage engine
- 5.2.3 Innodb status check
- 5.2.4 Applicable scenarios
- 5.2.4 (Extended) What is a lock
- 5.2.3.1 What is a lock ?
- 5.2.3.2 Type of lock:
- 5.2.3.3 Compatibility relationship between write lock and read lock (compatibility for one row)
- 5.2.3.4 Lock granularity :
- 5.2.3.5 Blocking and deadlock
##5.3 CSV storage engine- ##5.3. 1 Characteristics of CSV storage engine
- 5.3.2 Applicable scenarios of CSV storage engine
- ##5.4 Archive storage engine
- ##5.4 .1 File system storage features
- 5.4.2 Archive storage engine features
- 5.4.3 Archive storage engine usage scenarios
- ##5.5 Memory storage engine
5.5.1 File system storage characteristics - 5.5.2 Functional characteristics of Memory
- 5.5.3 Easily confused concepts in Memory
- 5.5.4 Memory usage scenarios
- 5.6 Federated storage engine
5.6.1 Federated features- 5.6.2 How to use Federated
- 5.6.3 Applicable scenarios of Federated
- 6 How to choose the correct storage engine
Continued from the previous article
5 MySQL architecture
Next we select some of the more commonly used storage A brief explanation of the engine. The storage engine used by MySQL will have a direct impact on the performance of the database. I also hope that you can carefully understand some of the characteristics of the storage engine before using the storage engine.
5.1 MyISAM
create table, but refers to the amount of data used during operations such as sorting and grouping. After exceeding a certain size, there are temporary tables created by the query optimizer. The MyISAM storage engine is composed of MYD and MYI. MYD is the extension of the data file and MYI is the extension of the index file. This storage engine stores tables in data files and index files with these two extensions. middle.
Features:
Concurrency and lock level
- MyISAM supports checking and repairing MyISAM tables that are damaged due to any unexpected shutdown, but the repair mentioned here is not data recovery, because MyISAM is not transactional storage engine, so it cannot perform related logs required for transaction recovery, so be aware that the recovery of MyISAM tables may cause data loss.
- We can check the table through
check table tablename and restore the table through - repair table tablename
.Index types supported by MyISAM tables
MyISAM supports full-text indexing, and was the only official storage engine that natively supported full-text indexing before mysql5.7.MyISAM table supports data compression
If MyISAM represents a large read-only table, that is, after the table is created and the data is imported, no modifications will be made to the table, then we will Tables can be compressed to reduce disk I/O. We can use the - myisampack
command to compress the table. Compression compresses the table independently, so when reading a row of data, it is not necessary to decompress the entire table. -
Restrictions: Version - Applicable scenarios:
- Non-transactional applications
- 5.2 Innodb
-
Innodb is the default storage engine for MySQL 5.5 and later versions. Innodb is the storage engine for transaction storage, which means it supports transaction processing.
Innodb has its own concept of table space, and the data is stored in the table space, which is determined by theinnodb_file_per_table
parameter. If this parameter isON
, A system file with the extensionibd
will be created for each Innodb table. If this parameter isOFF
, the data will be stored in the system's shared table space, that isibdataX
,X
represents a number, starting from 1 by default.
The command to view this parameter is:show variables like 'innodb_file_per_table';
The command to modify this parameter is:set global innodb_file_per_table=off;
5.2.1 How to choose between system table space and independent table space
Comparison:
System table space Independent table space Cannot simply shrink the file size You can pass optimize table
Command to shrink system fileswill cause IO bottleneck Can refresh data to multiple files at the same time Recommendation:
- Use independent table space for Innodb
Transfer the table that originally existed in the system table space to Methods in independent tablespaces.
Steps:
If you store a large table, you need to modify MAX_Rows and AVG_ROW_LENGTH
- Version> The default support for mysql5.0 is 256TB
Read-only applications (Reports and the like)
- Spatial Application
- Use mysqldump to export all database table data
- Stop the MySQL service, modify parameters, and delete Innodb related files
- Restart the MySQL service and rebuild the Innodb system table space
- Reimport the data
##5.2.2 Features of the Innodb storage engine
- Innodb is a transactional storage engine
- Fully supports the ACID characteristics of transactions (the atomicity, consistency, etc. introduced before)
- Redo Log and Undo Log
- Redo Log implementation The durability of the transaction is composed of two parts, one of which is the work log persistent buffer in memory, whose size is determined by innodb_log_buffer_size, and the other is the reconstructed log file, which is the ib_logflie we see in the file system related documents. Undo Log realizes the atomicity of transactions and performs rollback operations when transactions fail. Redo Log is read and written sequentially, and Undo Log is read and written randomly. If possible, the data can be stored in a solid-state drive to improve performance.
Innodb supports row-level locks - Row-level locks and table-level locks are different. The characteristic of row-level locks is that they can support concurrency to the greatest extent. Row-level locks are implemented by the storage engine layer.
5.2.3 Innodb status check
You can use the following command to check the Innodb status:
show engine innodb status
5.2.4 Applicable scenarios
Innodb is suitable for most OLTP applications, because after mysql5.7 version, Innodb already supports full-text index and spatial functions.5.2.4 (Extended) What is a lock
5.2.3.1 What is a lock?
- The main function of locks is to manage concurrent access to shared resources
- Locks are used to achieve transaction isolation
Shared lock (also called read lock)
- Exclusive lock (also called write lock)
Write lock |
Read lock | |
---|---|---|
Incompatible | Incompatible | |
Incompatible | Compatible |
The above is the detailed content of Big Data Learning Part 2 MYSQL Advanced. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
