Showing posts with label Optimize the tables using PHP. Show all posts
Showing posts with label Optimize the tables using PHP. Show all posts

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';