126 MySQL Storage Engine Overview

A, MySQL Storage Engine Overview

1.1 What is the storage engine?

MySQL data in a variety of different technologies stored in the file (or memory) in the. Each of these technologies technology uses a different storage mechanism, indexing techniques, lock level and ultimately provide a wide range of different functions and capabilities. By choosing different techniques, you can get extra speed or functionality, thereby improving the overall functionality of your application.

For example, if you are a large number of temporary data in the study, you may need to use memory storage engine. Memory storage engine to store all of the table data in memory. Or, you may need a support transaction processing database (to ensure that the transaction is unsuccessful rollback capability when data).

These different technologies and supporting the associated function is called in MySQL storage engine (also called table type).

MySQL default configuration of many different storage engines, you can pre-set or enabled in the MySQL server. You can choose to apply to servers, databases and tables storage engine in order to choose how to store your information, how to retrieve this information and data when you need to combine what your performance and functionality to provide maximum flexibility for you.

Choose how to store and retrieve your data, this flexibility is the main reason why the MySQL so popular. Other database systems (including most commercial choice) only support one type of data storage .

Unfortunately, other types of database solutions to take the "one size to meet all needs" approach means you are either to sacrifice some performance, either you use a few hours or even days of time detailed adjust your database. Using MySQL, we only need to modify the storage engines we use it.

1.2 MySql which storage engine support

mysql5.6 supported storage engines, including InnoDB, MyISAM, MEMORY, CSV, BLACKHOLE, FEDERATED, MRG_MYISAM, ARCHIVE, PERFORMANCE_SCHEMA. Which NDB and InnoDB provides transaction-safe tables, other storage engines are non-transaction-safe tables.

1.3 introduces a variety of search engines

InnoDB: MySql version 5.6 the default storage engine. InnoDB is a transaction-safe storage engine that has commit, rollback, and crash recovery features to protect user data. InnoDB row-level locking, and Oracle-style consistent non-locking read to enhance its multi-user concurrency and performance. InnoDB user data stored in the index to reduce aggregation query based on common primary key brings the I / O overhead. To ensure data integrity, InnoDB also supports foreign key constraints.

MyISAM: MyISAM neither support services, does not support foreign keys, its advantages are fast access speed, but the table-level locking limits its performance in terms of read and write load, so it is often used in read-only or read-mostly of data scene.

Memory: stores all data in memory, applied to the scene to look for non-critical data by fast. Memory type table access data very quickly, because it's data is stored in memory, and uses HASH indexes by default, but once the data service is shut down, the table will be lost

BLACKHOLE: Black Hole storage engine, Unix-like / dev / null, Archive is not saved but only receives data. Query on the table this engine often returns an empty set. Such a table may be applied to the DML statement needs to be sent from the server, but does not retain the primary server and the backup of such data from the master configuration.

CSV: Its table really is a comma-delimited text file. CSV table allows you to import and export data in CSV format, the same format and read and write scripts and applications interact with data. Since CSV table without an index, you'd better put InnoDB table data in general will operate only in the import or export phase uses about CSV table.

The NDB: (aka NDBCLUSTER) - this engine is particularly suitable for cluster data requires the highest degree of uptime and availability of applications. Note: NDB storage engine is not supported in the standard MySql 5.6 version. Currently supports

MySql cluster versions: Based on MySql 5.1 of MySQL Cluster NDB 7.1; based on MySQL Cluster NDB MySql 5.5 of 7.2; based on MySQL Cluster NDB MySql 5.6 7.3. Also based on MySql 5.6 of MySQL Cluster NDB 7.4 is currently under development.

Merge: Allow MySql DBA or a developer to a series of identical MyISAM tables are grouped and put them as an object reference. For ultra-large-scale data scenarios, such as a data warehouse.

Federated: provides the ability to create a logical database from a plurality of different physical machines coupled MySql server. Or the market for distributed data scenarios.

Example: This storage engine to start writing examples illustrate how to save MySql source of new storage engine. It is aimed at developers who are interested. This storage engine is a losers do not. "Stub." You can use this engine to create the table, but you can not save any data to which can not retrieve any index from them.

Second, the commonly used storage engine and usage scenarios

InnoDB: for transaction processing applications, support for foreign keys, and row-level locking. If the application for completeness things have relatively high requirements, data requirements under concurrent conditions consistency, data insertion and query operations in addition, also it includes many updates and deletes, then the InnoDB storage engine is more appropriate. In addition to effectively reduce the InnoDB caused by the lock deletes and updates can also ensure the integrity of the transaction commit and rollback for similar billing system or financial system for data accuracy requirements are relatively high system suitable choice.

MyISAM: If the application is read and insert operations-based, only a few of update and delete operations, and integrity, concurrency less demanding of the transaction, you can choose the storage engine.

Memory: all the data stored in memory, in the need to quickly locate records and other similar data environment, providing fast access. Memory drawback is that there are restrictions on the size of the table, although the database because of an abnormal termination, then data can be restored to normal, but once the database is shut down, the data will be stored in memory loss.

Guess you like

Origin www.cnblogs.com/XuChengNotes/p/11588520.html