From b296d7a710dc643ecdccd4141e862f7f778a6959 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 2 Apr 2010 17:52:44 +0200 Subject: improve optimize script to work as well on weird named tables --- files/scripts/optimize_tables.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'files') diff --git a/files/scripts/optimize_tables.rb b/files/scripts/optimize_tables.rb index 52e726e..4eaaaa4 100644 --- a/files/scripts/optimize_tables.rb +++ b/files/scripts/optimize_tables.rb @@ -5,8 +5,8 @@ ENV['HOME'] = '/root' tables = %x{mysql -Bse "SELECT TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema','mysql') AND Data_free > 0 AND ENGINE IN ('MyISAM','InnoDB','ARCHIVE')"} tables.each { |table| tableitems = table.chomp.split(/\t/) - system "mysql #{tableitems[0]} -Bse \"OPTIMIZE TABLE #{tableitems[1]}\" | grep -q OK" + system "mysql #{tableitems[0]} -Bse \"OPTIMIZE TABLE #{tableitems[0]}.#{tableitems[1]}\" | grep -q OK" if $?.to_i > 0 then - puts "error while optimizing #{tableitems[0]}. #{tableitems[1]}" + puts "error while optimizing #{tableitems[0]}.#{tableitems[1]}" end } -- cgit v1.2.3