hi
Use the opimize table option for MySQL:
$optimize = "OPTIMIZE TABLE tbl_name[,tbl_name]...";
//and simply run this string as a MySQL query
...................
$del = mysql_query("DELETE FROM tbl_name where ...");
$opt = mysql_query($optimize);
//this should help