当前位置:网站首页>Yyds dry inventory comparison of several database storage engines

Yyds dry inventory comparison of several database storage engines

2022-07-06 02:32:00 getupos

Table of Contents

1. Mysql Introduction to storage engine

The concept of a storage engine is MySQL Characteristics , And it is a plug-in storage engine concept . To determine the MySQL Tables in the database can be saved in different ways . Users can use their own needs , Choose different storage methods 、 Whether to carry out entry processing, etc .

Use SHOW ENGINES Statement to view the engine types supported by the system

#yyds Dry inventory # Comparison of several database storage engines _mysql

The main parameters in the results are introduced as follows .
Engine Parameters : Refers to the name of the storage engine .
Support Parameters : explain MySQL Whether this kind of engine is supported .

Comment Parameters : Refers to comments on the engine .
Transactions Parameters : Indicates whether transaction processing is supported ,YES Indicates that it can be used ,NO Indicates not available .

XA Parameters : Indicates whether distributed transaction processing XA standard ,YES Express support .
Savepoints Parameters : Indicates whether savepoints are supported , So that the transaction can be rolled back to the savepoint ,YES Express support .

From the query results, we can get ,MySQ1 The supported storage engines are InnoDB、MRG_MYISAM、MEMORY,PERFORMANCE SCHEMA、ARCHIVE、FEDERATED、CSV、BLACKHOLE、MyISAM, among InnoDB Is the default storage engine , Of this engine Support Parameter values for DEFAULT.

2. InnoDB Storage engine

InnoDB yes MySOL A storage engine for databases ,InnoDB to MySQL The data table provides transactions 、 Return to . Crash repair capabilities and multi version concurrent control of transaction security , Support row locking and foreign keys .MySQL The default storage engine for is InnoDB.InnoDB The main features are as follows :
(1)InnoDB to MySOL Provided with commit , Transaction security of rollback and crash recovery capability (ACID compatible ) Storage engine .InnoDB Locked at line level and also at SELECT Statement provides a similar Oracle Non locked reading . These capabilities add to multi-user deployment and performance . stay SOL Querying , Be free to InnoDB Type of table with other MySQL The types of the tables are mixed up , Even in the same query can be mixed .

(2)InnoDB It's designed for maximum performance when dealing with huge amounts of data . its CPU Efficiency may be unmatched by any other disk based relational database engine .

(3) InnoDB Support for foreign key integrity constraints (FOREIGN KEY). When storing data in a table , Each table is stored in primary key order , If the primary key is not explicitly specified in the table definition ,InnoDB A... Will be generated for each line 6 Bytes of ROWID, And use this as the primary key .

(4)InnoDB It is used in many large database sites that need high performance .InnoDB Do not create directory , Use InnoDB when ,MySQL Will be in MySQL Create a data directory named ibdatal Of 10MB Automatic extended data file size , And two named ib_logfile0 and ib_logfile1 Of 5MB The size of the log file .

3. MyISAM Storage engine

MyISAM The storage engine is MySQL Common storage engines in , Used to be MySQL The default storage engine for ,MyISAM The storage engine is based on ISAM The development of storage engine , And it adds many useful extensions , Such as having a high insertion 、 Query speed, etc , But it doesn't support transactions , The main features are :
(1) A large file ( reach 63 Bit file length ) Supported on file systems and operating systems that support large files .

(2) When you mix delete with update and insert , Dynamically sized rows are less fragmented . This is done by merging adjacent deleted blocks , And if the next block is deleted , Just expand to the next block to automatically complete .

(3) Every MyISAM The maximum number of indexes for a table is 64. This can be changed by recompiling . The maximum number of columns per index is 16.

(4) The maximum bond length is 1000 byte . This can also be changed by compiling . For keys longer than 250 Byte case , Use a more than 1024 Byte key block .

(5) BLOB and TEXT Columns can be indexed .

(6)NULL Value is allowed in the column of the index .

(7) All numeric key values are stored first in high byte bits to allow a higher index compression .

(8) One for each watch AUTO INCREMENT Internal processing of columns .MyISAM by INSERT and UPDATE Operation to automatically update this column . This makes AUTO INCREMENT The column is faster ( At least 10%). After the value at the top of the sequence is deleted, it cannot be reused .
(9) You can put data files and index files in different directories .

(10) Each character column can have a different character set .
(11) Yes VARCHAR Tables can have fixed or dynamic record lengths .

(12)VARCHAR and CHAR Columns can be up to 64KB.
Use MyISAM The engine creates the database , Will produce 3 File . The name of the file starts with the name of the table , Extension refers to
The extension of the index file is the file type :frm File storage table definition , The extension of the data file is .MYD (MYData)

4. MEMORY Storage engine

MEMORY The storage engine is MySQL A special kind of storage engine in , It uses content stored in memory to create , And all the data is in memory , These characteristics are related to InnoDB Storage engine 、MyISAM Storage engines are different .MEMORY The main features are as follows :
(1)MEMORY Tables can have as many as each table 32 An index , Every index 16 Column , as well as 500 The maximum key length of bytes .
(2)MEMORY Storage engine execution HASH and BTREE Indexes .(3) Can be in a MEMORY There are non unique keys in the table .
(4)MEMORY Table uses a fixed record length format .(5)MEMORY I won't support it BLOB or TEXT Column .
(6) MEMORY Support AUTO INCREMENT Columns and pairs can contain NULL Index of the column of the value .(7) MEMORY Tables are shared among all clients ( Like anything else TEMPORARY surface ).
(8) MEMORY Table contents are stored in memory , Memory is MEMORY The table is shared with the internal table created by the server during the idle time of query processing .
(9) When there is no need for MEMORY The content of the table , To release MEMORY Memory used by table , Should carry out DELETE FROM or TRUNCATE TABLE, Or delete the table as a whole ( Use DROP TABLE).

5. Choice of storage engine

Different storage engines have their own characteristics , Suitable for different needs , In order to make a choice , First of all, we need to consider what different functions each storage engine provides . surface 3-1 Is the function comparison of common storage engines .
InnoDB Storage engine : If a submission is to be provided 、 Transaction security of rollback and crash recovery capability (ACID compatible ) Ability , It also requires concurrent control ,InnoDB Storage engine is a good choice .
MyISAM Storage engine : If the data table is mainly used to insert and query records , be MyISAM The engine can provide high processing efficiency , therefore MyISAM Storage engine is the first choice .
MEMORY Storage engine : If it's just temporary data storage , Not a lot of data , And no need for high data security , You can choose to save the data in memory MEMORY engine ,MySQL Use in MEMORY The storage engine stores the intermediate results of the query as a temporary table .
ARCHIVE Storage engine : If only INSERT and SELECT operation , You can choose ARCHIVE engine ,ARCHIVE

The storage engine supports high concurrency insertion operations, but it has a large self-service, but it is not conservative .ARCHIVE Storage engines are great for storing archived data , For example, log information can be used ARCHIVE engine .

All in all , Which engine to use should be selected flexibly according to the needs , Multiple tables in a database can use different engines to meet various performance and actual needs , Use the right storage engine , It will be helpful to the performance of the whole database .

原网站

版权声明
本文为[getupos]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140014582778.html