Thursday, 6 October 2016

Rebuild or compile Indexes on Mysql ndb cluster

To rebuild or verify Indexes on Mysql we can us alter table command.

this will tell you if any of index is having issues.
 i.e corrupt ,data issue related to index.

alter table table_name engine= engine_name;


1. Query to generate script of those tables whose indexes needs to be rebuild or compile.


select concat('alter table ', TABLE_SCHEMA,'.',table_name , ' engine=' , engine ,';' ) alters from information_schema.TABLES
where TABLE_SCHEMA='mydb';

2. Copy generated results and executed on either mysql command line or workbench GUI tool

i.e on mysql command line.

./mysql -u root -p -h hostname

alter table mydb.alteridentity engine=ndbcluster;
alter table mydb.audit_trail engine=ndbcluster;


No comments:

Post a Comment