MyISAM vs InnoDB
Posted: 29 September 2006 06:01 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  690
Joined  05-16-2004

I’m wondering if someone could explain to me the advantage of using MyISAM instead InnoDB for Expression Engine.  Would there be any difference in performance in using one type of table or another?

Thanks!

TTFN
Travis

 Signature 

Check out Hop Studios add-ons for EE:

* Deeploy Helper
* Edit This
* Publish Improve
* Reeveal Comments


Hop Studios Internet Consulting
http://www.hopstudios.com/

Profile
 
 
Posted: 29 September 2006 06:24 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5931
Joined  11-23-2003

I moved this to the lounge because it is not really a tech support question.  This would be a good subject to Google because there is a crazy number of articles written on this.  I don’t think I would be able to tell you anything new.  Expression Engine picks all of this for you so that you don’t have to worry about it though.

Oh… and you will get more exposure with these types of questions in the lounge or general area.  Pretty much only tech support only answers posts in the tech support area.

 Signature 

WebmasterBasic: Rent a Webmaster | EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 29 September 2006 07:06 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  690
Joined  05-16-2004

Good to know, and thanks for the move.

I do know the basic difference between InnoDB and MyISAM (thanks, Google!), but I was wondering if anyone could offer advice on the best use in a busy EE installation situation.

TTFN
Travis

 Signature 

Check out Hop Studios add-ons for EE:

* Deeploy Helper
* Edit This
* Publish Improve
* Reeveal Comments


Hop Studios Internet Consulting
http://www.hopstudios.com/

Profile
 
 
Posted: 30 September 2006 11:19 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5931
Joined  11-23-2003

EE uses MyISAM by default and it may require it though I am not sure.  Looking through the forums there is little discussion on this so I would guess this is not really an important issue.  There are many other areas on MySQL of much more importance for tweaking MySQL for optimum performance.  You might take a look at this book.

 Signature 

WebmasterBasic: Rent a Webmaster | EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 30 September 2006 08:35 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  78
Joined  05-12-2006

Why would EE require MyISAM?  There is nothing that MyISAM does that InnoDB cannot do, although the opposite is not true.

Travis, if indexes are used properly, InnoDB will be just as fast at reading data as MyISAM is. Any speed difference will be negligible.  If indexes are not properly used, then InnoDB will naturally be slower at reading.  Whether or not EE properly uses index, I cannot say as I have not examined the SQL queries that closely.  Though I would assume for the most part it does.

If you are reading from & writing to a table frequently, InnoDB will be a better choice because it locks for writes at the row level, so your tables will not be locked out from reading while being written to; only the row being wrote to will be locked.  MyISAM can only lock at the table level, so tables will be locked out from reads while being written to.  The most common example among most applications of frequent reads & writes is the session table.  I would at least make the session table InnoDB.

MyISAM also corrupts more easily than InnoDB; or rather a better way of saying it is that InnoDB has much better recovery that MyISAM does.  All that has to happen to corrupt a MyISAM table is for MySQL to die in the middle of a write.  If that happens, it is pretty much guaranteed that the table will be corrupt when MySQL comes back online.  If that happens with InnoDB, it will automatically recover itself to the state it was in prior to the write (or prior to the transaction if a transactions was being run).  It is a rare concern, but freak accidents do happen, and again using session tables as an example, it is more common than you might think for MySQL applications to get corrupt session tables if they are using MyISAM.  And it may not even need to be a freak accident like power outage.  If you are on a shared host, something could go wrong with MySQL that forces the system admin to kill it before it takes the server down, or maybe it does crash and take the server down.  There are a number of scenarios that can happen that could cause MySQL to die or have to be killed.  Hello MyISAM table corruption.

I am not saying InnoDB tables cannot become corrupted, they can, but it happens less frequently than it does with MyISAM, and in the case of recovering from crashes, it is automatic.  With MyISAM, if it crashes and corrupts a table your options are to attempt to repair the table and hope that works, and if not you have to manually restore the table from a backup which is unlikely to be a backup of the state of table the minute before the crash occurred.

Finally, if ACID compliance, key restrictions, transactions, or anything else that “traditional” RDBMS offer is of a concern for you, then again you will not find help from MyISAM but will need to use InnoDB.

It should be pretty clear which MySQL storage engine I prefer.  I completely stopped using MyISAM about 2 years ago and couldn’t be happier with InnoDB and can’t remember the number of times I have been saved by it.  That said, I think it is probably best to use what works for you.

Profile
 
 
Posted: 30 September 2006 08:47 PM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5931
Joined  11-23-2003

Why would EE require MyISAM?  There is nothing that MyISAM does that InnoDB cannot do, although the opposite is not true.

I have no clue and in fact I am probably wrong on that one.  I figured I had a 50 - 50 chance on the guess that EE requires MyISAM or not.  I was willing to take those odds considering there was no money on the bet.

 Signature 

WebmasterBasic: Rent a Webmaster | EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 06 December 2007 02:01 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  1
Joined  12-06-2007

So, bottom line—on MySQL 5.0, is it OK to change EE tables from MyISAM to InnoDB? Can I do this with no impact on EE?

Profile
 
 
Posted: 17 June 2009 10:14 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  912
Joined  12-14-2004

SOrry for resurrecting this…

Rackspace, my web host, emailed me to say that our tables were locking due to high traffic and it was taking down our DB server, so they changed the exp_templates table to InnoDB.

Is this bad? Can/should I have them change it back? Does it make a difference?

 Signature 

Love gadgets, technology, and pop culture? Visit us at Gear Live: http://www.gearlive.com

Profile
 
 
Posted: 17 June 2009 10:24 AM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  17379
Joined  06-03-2002

It’s not without its own set of problems, Andru.  Do you have template hit tracking disabled?  Nothing else first party should be writing to that table frequently.

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77542 Total Logged-in Users: 50
Total Topics: 101541 Total Anonymous Users: 28
Total Replies: 544329 Total Guests: 312
Total Posts: 645870    
Members ( View Memberlist )