On --MySQL storage engine

Bowen outline:

  • A, MyISAM storage engine;
  • Two, InnoDB storage engine;
  • Three, Memory storage engine characteristics;
  • Fourth, how to choose the right storage engine?

Foreword

Database storage engine is the underlying software component database, database management systems (DBMS) using the data engine to create, query, update, and delete data operations. Different storage engines provide different storage mechanism, indexing techniques, lock level and other functions, the use of different storage engines, you can also obtain a specific function. Many different database management systems support a variety of different data engine. MySQL storage engine is the core.

MySQL provides a number of different storage engines, including engines handle transaction-safe tables in the engine and handle non-transaction-safe tables. In MySQL, does not require the use of a server in the whole engine, the engine may be used for each different storage table for a specific request.

  • Storage engine that the white data storage formats, different storage engine function, different amount of space, read performance is different;
  • Database storage engine underlying software component database, different storage engines provide different storage mechanisms;
  • In MySQL, need not use the same storage engine in the entire server can be used for different storage engines each table;
  • MySQL supports multiple storage engines, such as InnoDB, MyISAM, Memory, Merge, Archive, CSV, Federated and so on.

A, MyISAM storage engine

1, MyISAM storage engine features

  • Prior to MySQL 5.5 using the default MyISAM engine, MySQL use InnoDB engine after 5.5 default;
  • MyISAM engine reads faster, less resource is relatively small, it does not support transactions do not support foreign key constraints, but supports full-text indexing;
  • Write blocking each other, that is when you can not read data write data, write data when you can not read the data;
  • MyISAM engine can only cache index, and not cache data.

2, MyISAM application scenarios

  • It does not require transaction support services, such transfers will not do;
  • More suitable for reading data traffic, frequent reading and writing operations does not apply;
  • Concurrency is relatively low, a relatively small modification of data traffic;
  • Relatively poor hardware resources the machine might consider using MyISAM engine.

Two, InnoDB storage engine

1, InnoDB storage engine features

  • Transactional database engine of choice, followed by support transaction-safe tables, supports row locking and foreign keys, MySQL 5.5.5 version, InnoDB as the default storage engine;
  • It has commit, rollback, and crash recovery capabilities transaction-safe storage engine, and can handle huge amounts of data, high performance and efficiency, full support for foreign keys integrity constraints;
  • Caching feature in a highly efficient, can also be cached data cache index, the hardware requirements are relatively high;
  • When using the InnoDB, will create a 10MB file size is automatically extended data ibdata1 named, and two named ib_logfile0 and ib_logfile1 log file size 5MB in the MySQL data directory.

2, InnoDB application scenarios

  • Transaction support business needs, highly concurrent business
  • More frequent data updates scenes, such as BBS, SNS, microblogging and other
  • Data consistency demanding services, such as prepaid transfers, bank card transfers

Three, Memory Storage Engine Features

  • Memory storage engine to store data in the table into memory, providing quick access to data queries and references to other tables;
  • Memory storage engine performs HASH and BTREE index, does not support BLOB and TEXT columns, and to support the AUTO_INCREMENT column may contain NULL columns worth of the index;
  • When the table of contents Memory is no longer needed to free the memory used by Memory tables, should be executed DELETE FROM or TRUNCATE TABLE, or delete the entire table.

Fourth, how to choose the right storage engine?

Different business needs to choose different storage engines, concrete can be selected with reference to the following points:

  • If you want to provide commit, rollback, and crash recovery capabilities of transaction security capabilities, and requirements to achieve concurrency control, InnoDB is a good choice;
  • If a data table queries primarily for inserting and recording, the MyISAM engine provides high efficiency;
  • If only temporarily stored data, the amount of data, and does not require high security, you can choose the data stored in memory Memory engine, MySQL uses the engine as a temporary table to store intermediate results of the query;
  • If only INSERT and SELECT operations may be selected Archive Engine, highly concurrent insertion operations, such as logging information may be used Archive Engine.

The three primary functions supported by the data engine shown in the following table:

On --MySQL storage engine

-------- end of this article so far, thanks for reading --------

Guess you like

Origin blog.51cto.com/14154700/2455842