You are here

public function MySqlHandler::optimizeTable in DB Maintenance 8

Same name and namespace in other branches
  1. 7.2 src/Module/Db/DbServer/MySql/MySqlHandler.php \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler::optimizeTable()
  2. 2.0.x src/Module/Db/DbServer/MySql/MySqlHandler.php \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler::optimizeTable()

Optimizes table in the active database.

Overrides DbServerHandlerInterface::optimizeTable

File

src/Module/Db/DbServer/MySql/MySqlHandler.php, line 30
MySqlHandler class.

Class

MySqlHandler
MySqlHandler class.

Namespace

Drupal\db_maintenance\Module\Db\DbServer\MySql

Code

public function optimizeTable($table_name) {
  try {
    \Drupal::database()
      ->query("OPTIMIZE TABLE {$table_name}")
      ->execute();
  } catch (\Exception $e) {
    watchdog_exception('type', $e);
  }
}