MySQL Storage Engines
MySQL Storage Engines
For MySQL 5.5 and later, the default storage engine is InnoDB. The default
storage engine for MySQL prior to version 5.5 was MyISAM. Choosing the right
storage engine is an important strategic decision, which will impact future
development. In this tutorial, we will be using MyISAM, InnoDB, Memory and CSV
storage engines. If you are new to MySQL and your are studying the MySQL
database management system, then this is not much of a concern. If you are
planning a production database, then things become more complicated.
InnoDB
MyISAM
Memory
CSV
Merge
Archive
Federated
Blackhole
Example
InnoDB is the most widely used storage engine with transaction support. It is an
ACID compliant storage engine. It supports row-level locking, crash recovery and
multi-version concurrency control. It is the only engine which provides foreign key
referential integrity constraint. Oracle recommends using InnoDB for tables except
for specialized use cases.
MyISAM is the original storage engine. It is a fast storage engine. It does not
support transactions. MyISAM provides table-level locking. It is used mostly in
Web and data warehousing.
Memory storage engine creates tables in memory. It is the fastest engine. It
provides table-level locking. It does not support transactions. Memory storage
engine is ideal for creating temporary tables or quick lookups. The data is lost
when the database is restarted.
CSV stores data in CSV files. It provides great flexibility because data in this
format is easily integrated into other applications.
Merge operates on underlying MyISAM tables. Merge tables help manage large
volumes of data more easily. It logically groups a series of identical MyISAM
tables, and references them as one object. Good for data warehousing
environments.
Archive storage engine is optimised for high speed inserting. It compresses data as
it is inserted. It does not support transactions. It is ideal for storing and retrieving
large amounts of seldom referenced historical, archived data.
The Blackhole storage engine accepts but does not store data. Retrievals always
return an empty set. The functionality can be used in distributed database design
where data is automatically replicated, but not stored locally. This storage engine
can be used to perform performance tests or other testing.
Federated storage engine offers the ability to separate MySQL servers to create
one logical database from many physical servers. Queries on the local server are
automatically executed on the remote (federated) tables. No data is stored on the
local tables. It is good for distributed environments.