mysqlinnodbmyisammysql-5.7storage-engines

What are the current differences between MyISAM and InnoDB storage engines specifically in MySQL 5.7?


I saw so many questions and answers on this topic MyISAM vs InnoDB on stackoverflow itself.

But, all of the questions and answers are too old and not related to the current stable version of MySQL 5.7.x

By the time so much development must have been done in both MyISAM and InnoDB.

So, I need those differences available presently with version 5.7.x

So, please don't mark my question duplicate and someone please explain the differences these storage engines have currently as well as the differences they have since past.

Also, please explain at what situation which storage engine should be chosen for a table.

Can different tables belonging to the same schema have different storage engines i.e. few tables will have InnoDB and few ones will have MyISAM.

If yes, then how the JOIN queries would get execute between tables with MyISAM and InnoDB?

Is it true that MySQL is going to remove MyISAM storage engine from the future version?


Solution

  • Your assumption that MyISAM has been receiving new development is not correct. MyISAM is not receiving any significant new development. MySQL is clearly moving in the direction of phasing out MyISAM, and using MyISAM is discouraged.

    Oracle Corp. has not announced any specific date or version by which they will remove MyISAM. My guess is that MyISAM will never be fully removed, because there are too many sites that wouldn't be able to upgrade, without doing expensive testing to make sure their specific app won't experience any regression issues by converting to InnoDB.

    But you might notice that in the MySQL 5.7 manual, the section on MyISAM has been demoted to Alternative Storage Engines, which should be a clue that it's receiving less priority.

    In MySQL 5.7, MyISAM is still used for some of the system tables, like mysql.user, mysql.db, etc. But new system tables introduced in 5.6 and 5.7 are InnoDB. All system tables are InnoDB in MySQL 8.0.

    MyISAM still does not support any of the properties of ACID. There are no transactions, no consistency features, and no durable writes. See my answer to MyISAM versus InnoDB.

    MyISAM still does not support foreign keys, for what it's worth. But I seldom see real production sites using foreign keys even with InnoDB.

    MyISAM supports only table-level locking (except for some INSERT appending to the end of a table, as noted in the manual).

    MySQL 5.7 supports both fulltext indexes and spatial indexes in both MyISAM and InnoDB. These features are not reasons to continue using MyISAM as they once were.

    Both logical backup tools like mysqldump and physical backup tools like Percona XtraBackup can't back up MyISAM tables without acquiring a global lock.

    You asked if you could create a variety of tables with different storage engines in the same schema. Yes, you can, and this is the same as it has been for many versions of MySQL.

    You asked if you can join tables of different storage engines (by the way, tables don't need to be in the same schema to be joined). Yes, you can join such tables, MySQL takes care of all the details. This is the same as it has been for many versions of MySQL.

    But some weird cases can come up when you do this, like what if you update a MyISAM table and an InnoDB table in a transaction, and then roll back? The changes in the InnoDB table are rolled back, but the changes in the MyISAM table are not rolled back, so your data integrity can be broken if you aren't careful. This is also the same as it has been for many versions of MySQL.

    Cases where MyISAM has an advantage over InnoDB is a short list, and it's getting shorter.

    There are other options these days for compact storage of data in transactional storage engines, for example InnoDB table compression, or MyRocks.

    References:

    https://www.percona.com/blog/2016/10/11/mysql-8-0-end-myisam/

    https://www.percona.com/blog/2017/12/04/internal-temporary-tables-mysql-5-7/

    http://jfg-mysql.blogspot.com/2017/08/why-we-still-need-myisam.html