InnoDB or myISAM?

That’s a hard choice. Back in 2008 I also ran into some newer engines, but in my speed tests I realised none of them were as fast as the two old stalwarts: InnoDB or MyISAM. The rule of thumb then: MyISAM offers raw speed, whereas InnoDB offers reliability.

Let’s look at both engines in depth.

InnoDB

  • Supports transactions, row-level locking, and foreign keys.
  • Built for high volume: maximum performance when processing large data volumes, with good CPU efficiency.
  • Maintains its own buffer pool for caching data and indexes in main memory.
  • Data integrity: with transactional guarantees, a crash doesn’t leave half-written tables behind.

MyISAM

  • No transactions; only table-level locking.
  • Historically faster for simple, read-heavy workloads.
  • Simplicity: the on-disk format is easy to copy around and inspect.
  • Has been around longer.

A quick benchmark from 2008

My original test inserted 1,000 rows into two identical tables, differing only in the engine:

CREATE TABLE data (
  id int not null auto_increment primary key,
  name varchar(120) not null,
  text varchar(120) not null
) ENGINE=InnoDB;

CREATE TABLE dataisam (
  id int not null auto_increment primary key,
  name varchar(120) not null,
  text varchar(120) not null
) ENGINE=MyISAM;

The driver script was plain PHP with the old mysql_* extension (removed in PHP 7), generating random names in a loop and timing each batch with time(). The results were lopsided — MyISAM barely noticed the workload:

RunMyISAMInnoDB
11 sec33 sec
20 sec29 sec
31 sec30 sec

An important caveat for anyone reading those numbers in 2026: the script did 1,000 single-row INSERTs with no explicit transaction, so InnoDB was fsync’ing (or at least group-commiting) per statement while MyISAM just appended to the data file. Wrap the inserts in one transaction and the gap collapses. That benchmark says as much about the test design as about the engines.

2008 comparison of MySQL storage engines on different hardware

What changed since 2008

This choice used to be a real debate. It isn’t anymore: InnoDB has been the default storage engine since MySQL 5.5 (2010). MySQL 8.0 moved even the system tables to InnoDB, and new server features (like data dictionaries and some optimizer work) simply assume it. MyISAM still exists and still runs, but it is effectively in maintenance mode — no transactions, no MVCC, no crash-safe design, and it does not support modern features such as some newer SQL constructs at all. Full-text search, once MyISAM’s last bastion, has been in InnoDB since MySQL 5.6.

Tips

  • You can mix table types in the same database — that was true in 2008 and still is. But today the reason to do it is rare.
  • The original tip about ini_set(’max_execution_time’, 600) for long-running PHP scripts still applies, or set max_execution_time, max_input_time, and memory_limit in php.ini.
  • If you inherit a legacy schema full of MyISAM tables, migrate them: ALTER TABLE t ENGINE=InnoDB is online in modern MySQL and usually painless.

Even though MyISAM was faster than InnoDB in my 2008 insert benchmark, InnoDB is fast compared to any database engine. With InnoDB you get transactions, speed, and integrity — three features not usually used in the same sentence back then. My reflex in 2008 was to always use InnoDB unless there was a compelling reason for MyISAM, and it had to be really, really compelling. Eighteen years later that call turned out to be right: it’s InnoDB everywhere, and the debate is over.

3 thoughts on “InnoDB or myISAM?

  1. cevarief says:

    Try to use begin and commit transaction statement for innodb between insert to speed up the process :D, and compare again with myisam.

    Reply
  2. cevarief says:

    mysql_query(“BEGIN”);
    for($i=0;$i<$row;$i++)
    {
    $s = rand(0,25);
    $l = rand(4,10);
    $name = substr($let,$s,$l);
    $query=mysql_query(”insert into data(id,name,text) values(”,’$name’,’text’)”);
    }
    mysql_query(“COMMIT”);

    Reply
  3. worthposting says:

    The bottom line for me is always use innoDB.

    I have a heavy duty script to synchronize 2 databases using mssql and mysql. I ll try to implement it there and i ll be back to share my remarks.

    Thanx anywayz…

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *