Jump to content

InnoDB, MyISAM, MySQL and MariaDB

Recommended Posts

  • 2 weeks later...


The MyISAM storage engine in MySQL.

  • Simpler to design and create, thus better for beginners. No worries about the foreign relationships between tables.
  • Faster than InnoDB on the whole as a result of the simpler structure thus much less costs of server resources.
  • Full-text indexing.
  • Especially good for read-intensive (select) tables.


The InnoDB storage engine in MySQL.

  • Support for transactions (giving you support for the ACID property).
  • Row-level locking. Having a more fine grained locking-mechanism gives you higher concurrency compared to, for instance, MyISAM.
  • Foreign key constraints. Allowing you to let the database ensure the integrity of the state of the database, and the relationships between tables.
  • InnoDB is more resistant to table corruption than MyISAM.
  • Support for large buffer pool for both data and indexes. MyISAM key buffer is only for indexes.
  • MyISAM is stagnant; all future enhancements will be in InnoDB

MyISAM Limitations:

  • No foreign keys and cascading deletes/updates
  • No transactional integrity (ACID compliance)
  • No rollback abilities
  • 4,284,867,296 row limit (2^32)
  • Maximum of 64 indexes per row

InnoDB Limitations:

  • No full text indexing (Below-5.6 mysql version)
  • Cannot be compressed for fast, read-only



MyISAM vs InnoDB

Today we will focus on MyISAM vs InnoDB. The major difference between MyISAM and InnoDB is in referential integrity and transactions. There are also other difference such as locking, rollbacks, and full-text searches.

Referential Integrity

Referential integrity ensures that relationships between tables remains consistent. More specifically, this means when a table (e.g. Listings) has a foreign key (e.g. Product ID) pointing to a different table (e.g. Products), when updates or deletes occur to the pointed-to table, these changes are cascaded to the linking table. In our example, if a product is renamed, the linking table’s foreign keys will also update; if a product is deleted from the ‘Products’ table, any listings which point to the deleted entry will also be deleted. Furthermore, any new listing must have that foreign key pointing to a valid, existing entry.

InnoDB is a relational DBMS (RDBMS) and thus has referential integrity, while MyISAM does not.

Transactions & Atomicity

Data in a table is managed using Data Manipulation Language (DML) statements, such as SELECT, INSERT, UPDATE and DELETE. A transaction group two or more DML statements together into a single unit of work, so either the entire unit is applied, or none of it is.

MyISAM do not support transactions whereas InnoDB does.

If an operation is interrupted while using a MyISAM table, the operation is aborted immediately, and the rows (or even data within each row) that are affected remains affected, even if the operation did not go to completion.

If an operation is interrupted while using an InnoDB table, because it using transactions, which has atomicity, any transaction which did not go to completion will not take effect, since no commit is made.

Table-locking vs Row-locking

When a query runs against a MyISAM table, the entire table in which it is querying will be locked. This means subsequent queries will only be executed after the current one is finished. If you are reading a large table, and/or there are frequent read and write operations, this can mean a huge backlog of queries.

When a query runs against an InnoDB table, only the row(s) which are involved are locked, the rest of the table remains available for CRUD operations. This means queries can run simultaneously on the same table, provided they do not use the same row.

This feature in InnoDB is known as concurrency. As great as concurrency is, there is a major drawback that applies to a select range of tables, in that there is an overhead in switching between kernel threads, and you should set a limit on the kernel threads to prevent the server coming to a halt.

Transactions & Rollbacks

When you run an operation in MyISAM, the changes are set; in InnoDB, those changes can be rolled back. The most common commands used to control transactions are COMMIT, ROLLBACK and SAVEPOINT.
1. COMMIT - you can write multiple DML operations, but the changes will only be saved when a COMMIT is made
2. ROLLBACK - you can discard any operations that have not yet been committed yet
3. SAVEPOINT - sets a point in the list of operations to which a ROLLBACK operation can rollback to


MyISAM offers no data integrity - Hardware failures, unclean shutdowns and canceled operations can cause the data to become corrupt. This would require full repair or rebuilds of the indexes and tables.

InnoDB, on the other hand, uses a transactional log, a double-write buffer and automatic checksumming and validation to prevent corruption. Before InnoDB makes any changes, it records the data before the transactions into a system tablespace file called ibdata1. If there is a crash, InnoDB would autorecover through the reply of those logs.


InnoDB does not support FULLTEXT indexing until MySQL version 5.6.4. As of the writing of this post, many shared hosting providers’ MySQL version is still below 5.6.4, which means FULLTEXT indexing is not supported for InnoDB tables.

However, this is not a valid reason to use MyISAM. It’s best to change to a hosting provider that supports up-to-date versions of MySQL. Not that a MyISAM table that uses FULLTEXT indexing cannot be converted to an InnoDB table.


In conclusion, InnoDB should be your default storage engine of choice. Choose MyISAM or other data types when they serve a specific need.

Link to comment
Share on other sites

Some great input there guys thanks!

As I am planning to convert to MariaDB I was looking at their site too and they raise concerns over indexes. Running the tests they suggest certainly highlight a few possible missing indexes. I was concerned that it might adversely impact ipb:


I exported the schema as suggested at the top of the article and searched for primary, fulltext and keys as suggested. I guess I am looking for tables that have no primary key & fulltext?

Has anyone else tried this?

Am I missing something?

Link to comment
Share on other sites

Yes it will be better to convert them all to Innodb and performance will be much better as you will avoid the locking of the tables.....

Innodb will not have better performance only on very small databases and very well optimized.....

When  i say small i mean a few megabytes.....

So Innodb is the best for many reasons that you can read on my above post like performance and your data will be more secure......

Link to comment
Share on other sites

  • 2 weeks later...

In updating to MariaDB 10.1 from MySQL 5.51 what upgrade path would you recommend?

Should I update all tables to InnoDB before the move or after the move?

Should I simply install MariaDB 10.1, or go in steps via MySQL 5.6?

The issue is further complicated by the system running on Amazon Linux. I intend moving to a MariaDB built Amazon image using Ubuntu or Cent.

Link to comment
Share on other sites

15 hours ago, ASTRAPI said:

It will be safe if you want to try to go first to MariaDB 5.5.54 and then to MariaDB 10.1.21 ....

Interesting! I am guessing I can just install MariaDB 5,5.54 directly over the top of MySQL.... sounds promising :) Thanks

My plan then would be to upgrade to MariaDB 5.5.54 on Amazon Linux, then upgrade to 10.1, then spin up 10.1 on CentOS and mirror the database over, before swapping databases and stopping the Amazon Linux server. I can then change tables to InnoDB.

Link to comment
Share on other sites

  • 1 month later...

I was trying to convert MyISAM tables to InnoDB on my test site but I got the same error for 5 tables.

 ALTER TABLE `core_widgets` ENGINE=InnoDB;
 ALTER TABLE `core_sitemap` ENGINE=InnoDB;
 ALTER TABLE `core_search_index` ENGINE=InnoDB;
 ALTER TABLE `core_dev` ENGINE=InnoDB;
 ALTER TABLE `cms_page_widget_areas` ENGINE=InnoDB;
 ALTER TABLE `cms_databases` ENGINE=InnoDB;
 #1071 - Specified key was too long; max key length is 767 bytes

Should they be kept on MyISAM or is there a way to convert them too ?

Link to comment
Share on other sites

24 minutes ago, RevengeFNF said:

Yes, in your mysql configuration add this:


Now convert them using:



Thanks :) Worked perfectly :)

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 3 weeks later...

To flip-flop easily between the two, you can use the following:

To convert INTO InnoDB, run this SQL operation first:

SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ' engine=InnoDB row_format=dynamic;') 
FROM information_schema.TABLES WHERE ENGINE = 'MyISAM';

This will output a list of tables. You will need to expand your options and swap to "full text", and edit the number of displayed rows. The output here is pre-built Quarries that you will then run again through SQL operations. To convert back to MyISAM, simply flip InnoDB and MyISAM.

Link to comment
Share on other sites

When using MariaDB, should Aria be a consideration over InnoDB?

What would your choice be when using dedicated (it's VM, but I control the host) SSD storage?

I'm not really noticing any major performance issues when swapping between InnoDB and Aria. I have an issue where posting replies can take several seconds and I'm struggling getting to the bottom of it.

Link to comment
Share on other sites

26 minutes ago, jpg said:

I have an issue where posting replies can take several seconds and I'm struggling getting to the bottom of it.

This might be related to the notification emails as I was having the same issues, turned out it was sparkpost fault. 

Does it happen on only large threads or new ones too? How many subscribers does the thread has? Does it happen when you edit a reply or just when you post a new one?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...