From MyISAM to InnoDB

Events happening in the community are now at Drupal community events on www.drupal.org.
vacilando's picture

Hi,

I am moving existing sites from various servers to Pressflow. Looking at the tables, I see a mixture of MyISAM and InnoDB tables.

I understand that Pressflow uses InnodDB as the default storage engine. And I see in many places InnoDB usually makes Drupal fast (e.g. see this).

Two questions:

1) If one built a website from scratch in Pressflow, would all tables use InnoDB instead of MyISAM? In other words, is it (probably) good to convert ALL MyISAM tables to InnoDB or only a few of them?

2) Can somebody please share a snippet that of code that would convert a number (all within a database) MyISAM tables to InnoDB?

Thanks!

Comments

The DB Tuner module lets you

morningtime's picture

The DB Tuner module lets you convert (all) tables to InnoDB. It also lets you add indexes, tests for slow views queries and checks your MySQL config.

But I also wonder about the necessity of InnoDB. I read a 2Bits article where they only convert some tables to InnoDB, like the sessions table. Only a handful, not all of them.

This SQL snippet converts all

morningtime's picture

This SQL snippet converts all tables to InnoDB (no changes needed, just run it exactly like this):

SELECT CONCAT(CONCAT('ALTER TABLE `',table_name,'`'),' ENGINE=INNODB;') FROM INFORMATION_SCHEMA.tables WHERE table_type='BASE TABLE'

Convert a single table like this:

ALTER TABLE my_table ENGINE=INNODB;

re: From MyISAM to InnoDB

Greg Coit's picture

Yes, if you built a website from scratch in Pantheon, all the DB tables would be InnoDB.

Greg

--
Greg Coit
Systems Administrator
http://www.chapterthree.com

Thanks, Greg, but what about

vacilando's picture

Thanks, Greg, but what about all the tables that are then added by contrib modules... would they all also be in InnoDB?


---
Tomáš J. Fülöpp
http://twitter.com/vacilandois

re: Thanks, Greg, but what about

Greg Coit's picture

Yes, unless they specify the type of tables to be added, the default storage engine in the /etc/mysql/my.cnf file is InnoDB.

Greg

--
Greg Coit
Systems Administrator
http://www.chapterthree.com

Mercury

Group organizers

Group categories

Post Type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week