Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any pitfalls / things you need to know when changing from MyISAM to InnoDB

One of my projects use the MyISAM engine in MySQL, but I'm considering changing it to InnoDB as I need transaction support here and there.

  • What should I look at or consider before doing this?
  • Can I just change the engine, or should the data be prepared for it?
like image 308
Jrgns Avatar asked Oct 22 '08 10:10

Jrgns


People also ask

Should I change MyISAM to InnoDB?

A lot of older sites are still using the MyISAM storage engine in their database. Over recent years, InnoDB has shown to perform better and be more reliable. A big reason to use InnoDB over MyISAM, is the lack of full table-level locking. This allows your queries to process faster.

Is InnoDB better than MyISAM?

The performance of InnoDB for large volumes of data is better as compared to MyISAM. MyISAM doesn't support transactional properties and is faster to read. As compared to InnoDB, the performance for a high volume of data is less.

Why is InnoDB slower than MyISAM?

The InnoDB Buffer Pool caches data and index pages. MyISAM only caches index pages. Just in this area alone, MyISAM does not waste time caching data. That's because it's not designed to cache data.


1 Answers

Yes absolutely, there are many things, you should test your application extremely thoroughly:

  • Transactions can deadlock and need to be repeated. This is the case (in some circumstances) even with an autocommitted transaction which only inserts one row.
  • Disc usage will almost certainly increase
  • I/O load during writes will almost certainly increase
  • Behaviour of indexing will change because InnoDB uses clustered indexes - this may be a beneficial effect in some cases
  • Your backup strategy will be impacted. Consider this carefully.

The migration process itself will need to be carefully planned, as it will take a long time if you have a lot of data (during which time the data will be either readonly, or completely unavailable - do check!)

like image 82
MarkR Avatar answered Oct 26 '22 03:10

MarkR