75

I looked around and found some of the MySQL engines are innodb and MyISAM. Perhaps there are few more. My question is what are these database engines?

What are the differences between different MySQL engines? And more importantly, How do I decide which one to use?

Somnath Muluk
  • 55,015
  • 38
  • 216
  • 226
pavanred
  • 12,717
  • 14
  • 53
  • 59
  • 1
    Related: http://serverfault.com/questions/219/how-do-you-choose-a-mysql-database-engine – Pekka Nov 20 '10 at 16:50

3 Answers3

77
mysql> SHOW ENGINES;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+

I personally always use InnoDB if I have to use MySQL. It supports transaction and foreign keys while MyISAM doesn't.

Vincent Savard
  • 34,979
  • 10
  • 68
  • 73
41

MyISAM and InnoDB are the most commonly used engines.

MyISAM is slightly faster than InnoDB, and implements the FULLTEXT index which is quite useful for integrating search capabilities. MyISAM is not transacted and doesn't implement foreign key constraints, which is a major drawback.

But you can use the best of both and create tables with different storage engines. Some software (WordPress, I think) use Inno for most data, like relations between pages, versions etc. Records for the posts contain an ID that links to a record in a separate content table that uses MyISAM. That way, the content is stored in the table that has the best search capabilities, while most other data is stored in tables that enforce data integrity.

If I were you, I'd pick Inno, because it is the most reliable. Only use MyISAM for specific purposes if you need to.

You can configure your database to use InnoDB by default when creating new tables.

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • Another restriction of the MyISAM is that the (primary) key (single or composed) can't be bigger than 1000 bytes long, which in most cases it is ok, but you eventually may reach this limit when building some larger BI models. – Paulo Bueno Apr 16 '20 at 14:06
1

Maybe you will get more info here: https://en.wikipedia.org/wiki/Database_engine

A database engine (or storage engine) is the underlying software component that a database management system (DBMS) uses to create, read, update and delete (CRUD) data from a database. Most database management systems include their own application programming interface (API) that allows the user to interact with their underlying engine without going through the user interface of the DBMS.

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
Mogli
  • 740
  • 6
  • 8