Friday, November 18, 2011

Optimize the tables in a Database using PHP

$alltables = db_query("SHOW TABLES");
while ($tablename = db_result($alltables)) {
  db_query("OPTIMIZE TABLE '".$tablename."'");
  echo $tablename." optimized now";
}
echo 'All tables optimized successfully';

No comments: