Mysql data table six types _ MySQL

Source: Internet
Author: User
Six types of mysql data tables

MySQL data tables support six types: BDB, HEAP, ISAM, MERGE, MYISAM, and InnoBDB.

These six types are divided into two categories: transaction-safe, including BDB and InnoDB, and the other are in the second category, it is called non-transaction security (non-transaction-safe ).

BDBBrekeley DB is the earliest type of Mysql table with transaction capabilities, developed by Sleepycat Software ( It provides the transaction control capability, which ensures that all commands are successfully executed, or the results of all commands are rolled back when an error occurs in any command, it can be imagined that the transaction control capability in e-banking is very important. Supports COMMIT, ROLLBACK, and other transaction features. The latest version of Mysql has planned to remove support for BDB and develop InnoDB.

InnoDBIs a new transaction-safe storage engine used for transaction processing applications. it supports almost all the features of BDB and has many new features, including ACID transaction support.


  • Transaction processing mechanism

  • Support for external links

  • Immediate recovery after crash

  • Supports the foreign key function and cascading deletion

  • Support concurrency

  • Storage method on hard disk: InnoBDB frm

The latest version of Mysql has planned to remove support for BDB and develop InnoDB. InnoDB provides better support for Mysql features and is active in the development community.

MyISAMThe default MySQL plug-in storage engine is based on the ISAM type, but it adds many useful extensions, it is one of the most commonly used 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.

  • 1. smaller than the ISAM table, with less resources

  • 2. you can specify the type of binary porting table between different platforms when creating the table.

ISAMIs the default type used by MySQL tables before the MyISAM type is displayed, and is now replaced by MyISAM.

Memory (HEAP)It is the fastest table to access in MySQL tables. it stores all data in RAM and provides extremely fast access in environments where reference and other similar data need to be quickly searched. Note: the data in this type is non-persistent. it is generally applicable to temporary tables. if MySQL or the server crashes, all the data in the table is lost.

MergeIt is a new type of table that deserves attention. it is composed of a group of MyISAM tables, which are merged mainly for performance considerations because it can improve search speed and repair efficiency, saves disk space. 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. Sometimes it usesMRG_MYISAMThe name appears.

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

FederatedConnects multiple separated MySQL servers to create a logical database from multiple physical servers. It is very suitable for Distributed Environments or data mart environments.

NDBCluster/Cluster/NDBMySQL'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.

CSVText files separated by commas in the standard CSV format are used for external data exchange.

BlackholeIt accepts but does not save the data, and returns an empty set for any retrieval request. It is generally applicable to distributed database design where data is automatically copied and not stored locally. (Uncertain) it may also be used to temporarily disable/ignore database application input.

ExampleThis is a test engine. you can create such a table, but neither write nor retrieve data. It seems to be a sample engine provided for MySql developers.

The command syntax for operating and viewing table types is as follows:

? [Copy to clipboard] View Code SQL

---- Create table 'message' ('id' int (11) not null auto_increment, 'sender' varchar (255) default NULL, 'cycler' varchar (255) default NULL, 'content' text, 'is _ READ' char (1) default 'n', 'Send _ time' datetime default NULL, 'Del _ flag' tinyint (4) default '0', primary key ('id') ENGINE = MYISAM; -- you can also change it after creation: alter table 'message' ENGINE = INNODB; -- view the TABLE type (storage ENGINE) show table status from 'test'; -- result Is the information of all tables in the database test. The second type is the table type. -- View the table type (storage ENGINE) 2 show create table 'message'; -- the result is the information when the TABLE message is created, with either TYPE or ENGINE, specifies the table type (storage engine ). -- Show tables cannot obtain table type information.

Note: MySQL of earlier versions uses TYPE instead of ENGINE (for example, TYPE = MYISAM ). MySQL 5.1 supports this syntax for backward compatibility, but TYPE is currently ignored, and ENGINE is the first usage. Generally, the ENGINE option is unnecessary. Unless the default value has been changed, MyISAM is the default storage ENGINE.

Data table portability

Common data migration method: export the data table content to a text file, copy it to the hard disk, and import it to the target database.

For file-level operations, some data tables can be moved by directly copying table files separately. See the following table.

InnoBDB Yes

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: 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.