Jump to content
php.lv forumi

mysql datubaazhu optimizeeshana


Aleksandrs

Recommended Posts

Padomāju, sanāca šāds kods:

<?
ini_set('max_execution_time', 0);
$c_db = 'db';

$mysql = @mysql_connect('localhost', 'user', 'password');
if(!$mysql){
exit('Connect error!');
}
$mysql = @mysql_select_db($c_db);
if(!$mysql){
exit('Database error!');
}
$query = 'SHOW TABLE STATUS FROM `'.$c_db.'`';
$results = mysql_query($query);
while($row = @mysql_fetch_assoc($results)){
if($row['Data_free']>0){
 mysql_query('OPTIMIZE TABLE `'.$row['Name'].'`');
}
}
?>

 

Es tikai nevaru saprast, vai pēc optimize ir jalieto flush tables?

Edited by Aleksandrs
Link to comment
Share on other sites

×
×
  • Create New...