Run the following queries in mysql to prepare the script for reorg and analyze table commands to collect statistics.
select table_schema,table_name,engine,data_length, data_free from information_schema.tables where table_schema='ranger' and table_type='BASE TABLE';
select CONCAT('OPTIMIZE table ',table_schema,'.',table_name,';')"Reorg_Script" from information_schema.tables where table_schema='ranger' and table_type='BASE TABLE';
select CONCAT('ALTER TABLE ',table_schema,'.',table_name,' FORCE;')"Reorg_Script" from information_schema.tables where table_schema='ranger' and table_type='BASE TABLE';
select CONCAT('ANALYZE TABLE ',table_schema,'.',table_name,';')"Analyze_Script" from information_schema.tables where table_schema='ranger' and table_type='BASE TABLE';
No comments:
Post a Comment