Storage Engines

From Hashmysql

Jump to: navigation, search

What is a "storage engine", and how do I decide which one to use?

A storage engine, also known as a "table type", is the engine which actually handles the data for your table(s). This is an alien concept for people coming from another RDBMS, and it is in fact a pretty blatant violation of one of Codd's rules for relational databases, but in MySQL you are able to choose which engine to use on a table by table basis, so that you are not paying the cost of transactional overhead if you do not need it, or so that you can have row-level locking available when you need it, etcetera.

  1. MyISAM
    • This is the default storage engine. It uses table-level locking (so is not always a good choice if you have a large number of concurrent reads and writes on the same table); it does not support foreign keys or transactions. It is an extremely fast engine aside from cases involving very large BLOB/TEXT columns or concurrent reads/writes.
  2. InnoDB
    • Supports row-level locking (making it ideal for high concurrency of reads/writes), foreign keys and transactions. Also performs better with large BLOB/TEXT columns. Uses a clustered index against the primary key (controlling physical order of data on disk).
  3. NDB
    • This is the storage engine for MySQL Cluster.
  4. HEAP or MEMORY
    • These tables are stored in RAM (and thus the data will not survive a restart/reboot).
  5. BDB
    • Berkeley DB.
Personal tools