Application and features of the MySQL storage engine

Source: Internet
Author: User
The following articles mainly describe the actual application of the MySQL storage engine and the unique characteristics of the main storage engines in the MySQL database, I hope that you will be helpful when selecting the database storage engine after reading this article. The specific content of this article is as follows. MySQL has multiple storage engines: MyISAM, InnoDB, MERGE, MEMORY (HEAP), and B

The following articles mainly describe the actual application of the MySQL storage engine and the unique characteristics of the main storage engines in the MySQL database, I hope that you will be helpful when selecting the database storage engine after reading this article. The specific content of this article is as follows. MySQL has multiple storage engines: MyISAM, InnoDB, MERGE, MEMORY (HEAP), and B

The following articles mainly describe the actual application of the MySQL storage engine and the unique characteristics of the main storage engines in the MySQL database, I hope that you will be helpful when selecting the database storage engine after reading this article. The specific content of this article is as follows.

MySQL has multiple storage engines:

MyISAM, InnoDB, MERGE, MEMORY (HEAP), BDB (BerkeleyDB), EXAMPLE, FEDERATED, ARCHIVE, CSV, and BLACKHOLE.

MySQL supports several storage engines as processors for different table types. The MySQL storage engine includes the engine for processing transaction security tables and the engine for processing non-transaction security tables:

MyISAM manages non-transaction tables. It provides high-speed storage and retrieval, as well as full-text search capabilities. MyISAM is supported in all MySQL configurations. It is the default MySQL storage engine, unless you configure MySQL to use another engine by default.

The MEMORY storage engine provides "in-MEMORY" tables. The MERGE storage engine allows a set to process the same MyISAM table as a separate table. Like MyISAM, MEMORY and MERGE storage engines process non-transaction tables. Both engines are included in MySQL by default.

Note: The MEMORY storage engine is officially identified as the HEAP engine.

The InnoDB and BDB storage engines provide transaction security tables. BDB is included in the MySQL-Max binary distribution version released for the operating system that supports it. InnoDB is also included in all MySQL 5.1 binary distributions by default. You can configure MySQL to allow or disable any engine as you like.

The EXAMPLE storage engine is a "stub" engine that does not do anything. You can use this engine to create tables, but no data is stored or retrieved from them. The purpose of this engine is to provide a service. In the MySQL source code example, it demonstrates how to start writing a new storage engine. Similarly, it is mainly interested in developers.

NDB Cluster is a storage engine used by MySQL Cluster to split tables into multiple computers. It is provided in MySQL-Max 5.1 binary distribution. Currently, this storage engine is only supported by Linux, Solaris, and Mac OS X. In the future MySQL distribution version, we want to add support for this engine from other platforms, including Windows.

The ARCHIVE storage engine is used to store a large amount of data without indexing.

The CSV storage engine stores data in text files in a comma-separated format.

The BLACKHOLE storage engine accepts but does not store data, and retrieval always returns an empty set.

FEDERATED storage engine stores data in a remote database. In MySQL 5.1, it only works with MySQL and uses the MySQL C Client API. In future distributions, we want to connect it to another data source using another drive or client connection method.

When creating a new TABLE, you can add an ENGINE or TYPE option to the create table statement to tell MySQL what TYPE of TABLE you want to CREATE:

 
 
  1. CREATE TABLE t (i INT) ENGINE = INNODB;
  2. CREATE TABLE t (i INT) TYPE = MEMORY;

Although TYPE is still supported in MySQL 5.1, ENGINE is the preferred term.

How to select the storage engine that best suits you?

The following storage engines are the most commonly used:

MyISAM: the default MySQL plug-in storage engine, which is one of the most commonly used MySQL storage engines in Web, data warehousing, and other application environments. Note: by changing the STORAGE_ENGINE configuration variables, you can easily change the default storage engine of the MySQL server.

InnoDB: used for transaction processing applications. It has many features, including ACID transaction support.

BDB: it can replace the transaction engine of InnoDB and supports COMMIT, ROLLBACK, and other transaction features.

Memory: stores all data in RAM and provides extremely fast access in environments where you need to quickly search for references and other similar data.

Merge: Allows MySQL DBAs or developers to logically combine a series of equivalent MyISAM tables and reference them as one object. It is suitable for VLDB environments such as data warehousing.

Archive: provides a perfect solution for storing and retrieving a large number of rarely referenced historical, archived, or security audit information.

Federated: connects multiple separated MySQL servers to create a logical database from multiple physical servers. It is very suitable for distributed environments or data mart environments.

Cluster/NDB: MySQL's Cluster-based database engine is especially suitable for applications with high-performance search requirements. Such search requirements also require the highest normal working time and availability.

Other: Other storage engines include CSV (referencing files separated by commas as database tables), Blackhole (used to temporarily prohibit database application input ), and the Example engine (which can help you quickly create a custom plug-in storage engine ).

Remember that you do not have to use the same storage engine for the entire server or solution. You can use different MySQL storage engines for each table in the solution. This is very important.

 
 
  1. mysql> show engines;
  2. +————+———+—————————————————————-+
  3. | Engine | Support | Comment |
  4. +————+———+—————————————————————-+
  5. | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |
  6. | MEMORY | YES | Hash based, stored in memory, useful for temporary tables |
  7. | InnoDB | YES | Supports transactions, row-level locking, and foreign keys |
  8. | BerkeleyDB | NO | Supports transactions and page-level locking |
  9. | BLACKHOLE | NO | /dev/null storage engine (anything you write to it disappears) |
  10. | EXAMPLE | NO | Example storage engine |
  11. | ARCHIVE | NO | Archive storage engine |
  12. | CSV | NO | CSV storage engine |
  13. | ndbcluster | NO | Clustered, fault-tolerant, memory-based tables |
  14. | FEDERATED | NO | Federated MySQL storage engine |
  15. | MRG_MYISAM | YES | Collection of identical MyISAM tables |
  16. | ISAM | NO | Obsolete storage engine |
  17. +————+———+—————————————————————-+

The above content is an introduction to how to select the appropriate MySQL storage engine and the features of the main MySQL storage engines. I hope you will get some benefits.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.