Ranger - MYSQL schema reorg

Steps to prepare the script for reorg in MYSQL,

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

Boost Your Download Speed with lftp Segmentation

Looking for a faster way to download files via sftp to a Linux machine? Try using "lftp" instead. This tool offers segmented downl...

Other relevant topics