Using MyISAM engine for custom tables in Drupal 7

Drupal 7 uses InnoDB as default MySQL engine for all tables in database. Innodb is a better option for processing large volume of data. It gives good support for ACID property, however there are some cases where the InnoDB falls short of ones expectation. Some common examples includes count queries, memory use of Innodb,etc., see here to know more.

But for a Drupal site, it is not necessary for all tables to have a fully transactional and ACID compliant database, especially tables used as placeholder for items in queue, fragile data pulled from Webservice by making API call.  Now if you are aware about this already, you will think mysql engine can be changed for a table using 'ALTER TABLE tablename ENGINE = MyISAM' or using phpmyadmin UI from operations tab.

Custom Tables are created in Drupal using hook_schema(). It is possible to add some extra key => value to schema array in hook_schema() to use MyISAM for our table.

See the below code snippet for the same,

$schema['tablename'] = array(
  'fields' => array(
    //...field definitions
  'mysql_engine' => 'MyISAM',
'mysql_engine' => mysqlenginename.
Using the above code, you can create table with MyISAM engine, I hope this gives you better understanding about usage of MyISAM and mysql_engine.