MySQL - InnoDB vs MyISAM

I read the following article yesterday (http://blogs.sitepoint.com/2010/11/19/mysql-mistakes-php-developers/) and it wrote the following:

MySQL has a number of database engines but you’re most likely to encounter MyISAM and InnoDB.

MyISAM is used by default. However, unless you’re creating a very simple or experimental database, it’s almost certainly the wrong choice! MyISAM doesn’t support foreign key constraints or transactions which are essential for data integrity. In addition, the whole table is locked whenever a record is inserted or updated: it causes a detrimental effect on performance as usage grows.

The solution is simple: use InnoDB.

I've always used MyISAM because it was the default. What do you think?

If I were to upgrade to InnoDB, in phpMyAdmin, can I just edit each table and change it to innoDB or is there a more complex process to perform?

Thanks!

Answer #1:

Yes, you can swap in and out engines like used underwear, if you like, without much trouble. Just change it in phpmyadmin.

But I wouldn't change it for the sake of changing it. Do you need to use foreign keys? Change it. Do you need row-level-locking instead of table-locking? Change it.

It's worth noting that there are good reasons to use MyISAM, too. Take a look at FULLTEXT indexing. You can't do that with InnoDB.

UPDATE

As of MySQL 5.6 FULLTEXT has been implemented for InnoDB tables as well. Here is the manual.

Answered By: Stephen

Answer #2:

Sorry for bumping an old question, but this also helped me a lot to choose which engine, especially since MyISAM is faster for reads and my database tables had more read the write:

http://www.rackspace.com/knowledge_center/article/mysql-engines-myisam-vs-innodb

Answered By: NaturalBornCamper
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .



# More Articles