Ottimizzare tutte le tabelle in un database MySQL: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
Created page with "* Usare lo script <pre> #!/bin/bash for table in $(mysql -u root -proot_pwd -sss -e "select concat(table_schema,'.',table_name) from information_schema.tables where table_schema in ('mydatabasename') order by data_free desc;") do echo OPTIMIZE $table mysql -u root -proot_pwd -e "OPTIMIZE TABLE $table;" done </pre>"
 
(No difference)

Latest revision as of 14:47, 11 June 2024

  • Usare lo script
#!/bin/bash
for table in $(mysql -u root -proot_pwd -sss -e "select concat(table_schema,'.',table_name) from information_schema.tables where table_schema in ('mydatabasename') order by data_free desc;")
do
  echo OPTIMIZE $table
  mysql -u root -proot_pwd -e "OPTIMIZE TABLE $table;"
done