You are here

public function PgSqlHandler::optimizeTable in DB Maintenance 8

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

Optimizes table in the active database.

Overrides DbServerHandlerInterface::optimizeTable

File

src/Module/Db/DbServer/PgSql/PgSqlHandler.php, line 30
PgSqlHandler class.

Class

PgSqlHandler
PgSqlHandler class.

Namespace

Drupal\db_maintenance\Module\Db\DbServer\PgSql

Code

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