MyISAM

MyISAM is a storage engine employed by MySQL database that was used by default prior to MySQL version 5.5 (released in December, 2009). It is based on ISAM (Indexed Sequential Access Method), an indexing algorithm developed by IBM that allows retrieving information from large sets of data in a fast way.

Pros and Cons

MyISAM is very fast, and provides the best reading speed of all storage engines available in MySQL. However, if your application performs simultaneous reading and writing in one table, the engine′s performance falls down dramatically. This is explained by table-level locking: any time an application inserts data or updates a MyISAM table, all other operations are locked out.

Another big critique of MyISAM is the lack of transactions support. Without transactions, you can′t create referential actions, i.e. operations modifying several linked tables at once. For example, say that you have a CUSTOMERS table containing the list of customers, and an ORDERS table containing the list of orders (each order is associated with some customer). The idea of transactions implies that deleting a row in the "parent" table (CUSTOMERS) should delete all rows of the "child" table (ORDERS) that have a matching foreign key, and this operation can′t be stopped in the middle. Transaction-safe storage engines automatically roll back all operations included in a transaction if some of them fail to complete.

Handy Backup supports "live" backup and recovery of MyISAM tables that can be done in real time and doesn′t expect you to stop your MySQL server. To learn more, please see the MySQL Backup feature page.


MyISAM and InnoDB

Since MySQL 5.5, default storage engine changed to InnoDB. This doesn′t mean that InnoDB is better than MyISAM: as MySQL developers say, this was done because most users never change default settings, and InnoDB is more of general purpose engine.

At Handy Backup testing lab, we have done a simple comparative test. When there were no applications using MySQL, MyISAM was almost ten times faster than InnoDB:

Storage engine

INSERT row time, microseconds

UPDATE row time, microseconds

DELETE row time, microseconds

MySQL MyISAM

150.3

145.57

147.52

MySQL InnoDB

1494.43

1682.67

1892.46

Comparison of MyISAM and InnoDB speed on an idle database with an isolated query

However, when we put the database under load and the tables started receiving updates, InnoDB showed no significant reduction of speed, but MyISAM slowed down to 0.5 seconds and more.

Creating MyISAM Tables in MySQL 5.5 and Higher

In the last versions of MySQL, to create a table with MyISAM as a storage engine you need to add ENGINE=MyISAM to your CREATE TABLE statements, e.g:

CREATE TABLE table1 (I INT) ENGINE=MyISAM;

Or you can change the default engine back to MyISAM by issuing SET default_storage_engine=MyISAM.

Target Uses of MyISAM

At last, let′s discuss main target uses for the MyISAM storage engine:

  • Read-only tables. If your applications use tables that are never or rarely modified, you can safely change their storage engine to MyISAM.
  • Replication configuration. Replication enables you to automatically keep several databases synchronized. Unlike clustering, in which all nodes are self-sufficient, replication suggests that you assign different roles to different servers. Particularly, you can make an InnoDB-based Master database which is used for writing and processing data and MyISAM-based Slave database which is used for reading. To learn more, please read MySQL Replication.
  • Backup. The most effective approach to MySQL backup is a combination of Master-to-Slave replication and backup of Slave Servers. This is where Handy Backup proves its worth!
Small Windows Logo Download for Free

Version 8.5.3 , built on March 5, 2024. 116 MB
30-day full-featured trial period

See also:



Learn more:

  • Database Dump
    "Database dump is a text file containing a set of SQL statements that need to be run on an SQL server to create a database with the entire internal structure…"
  • Logical Backup
    "Logical backup is a copy of objects used in an application (e.g. database tables), that is made by accessing them through the application’s interfaces.…"
  • Shared-Nothing Architecture
    "Shared-nothing architecture (SNA) is a pattern used in distributing computing in which a system is based on multiple self-sufficient nodes that have their…"


Backup Terms Glossary

Who uses Handy Backup?