Difference in required time to insert InnoDB/MyISAM records Difference in required time to insert InnoDB/MyISAM records database database

Difference in required time to insert InnoDB/MyISAM records


It is unclear what durability settings you have enabled in MyISAM or Innodb, nor whether you're using single-row inserts, or batch inserts in either case.

If you are using single-row inserts, you aren't using transactions, and you have durability enabled (the default setting in InnoDB), then you are likely to see InnoDB performance severely limited by the requirement to commit each transaction to durable storage (i.e. disc) after each row insert.

MyISAM has no such problem, because it is not durable anyway, i.e. if the machine crashes you are more-or-less guaranteed to lose some recently written data which the database had previously claimed was written successfully (if not the whole table!).

If you want decent insert-performance, use batch inserts and/or transactions, otherwise you're just measuring the speed of a write followed by a fsync(), which (on a non-battery backed RAID controller on rotational magnetic media) is just the speed of your disc spinning.

So the reason innodb is so consistent, is that you're measuring the spin speed of your disc.

Having said that, if you have a busy server, you definitely, absolutely, want to use a battery-backed RAID controller, then you can achieve decent transaction commit performance AND proper durability (Assuming power does not fail for longer than the battery lasts, and the server doesn't explode etc).


To really see the performance differences, you'd need to run some real program on top of the DB. Just inserting tiny batch of records is not telling much. Insert speed depends a lot on things like column count, the amount of indices, transaction pattern, DB constraints and other activities taking place.