You are here

function webform_update_11 in Webform 5.2

Same name and namespace in other branches
  1. 5 webform.install \webform_update_11()
  2. 6.2 webform.install \webform_update_11()

Add unique indexes on Submission IDs for faster joins.

File

./webform.install, line 408

Code

function webform_update_11() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $ret[] = update_sql("ALTER TABLE {webform_submissions} ADD INDEX sid (sid)");
      $ret[] = update_sql("ALTER TABLE {webform_submitted_data} ADD INDEX sid (sid)");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE INDEX {webform_submissions}_sid_idx ON {webform_submissions}(sid)");
      $ret[] = update_sql("CREATE INDEX {webform_submitted_data}_sid_idx ON {webform_submitted_data}(sid)");
      break;
  }
  return $ret;
}