Thursday, February 8, 2024

How to check Master, Slave database differences

If you observed Master, Slave database difference, please execute the following SQL statements and check the results.

SELECT CONCAT(ROUND(SUM(data_length) / (1024*1024*1024),2),'GB') Data_Size, CONCAT(ROUND(SUM(index_length)/ (1024*1024*1024),2),'GB') Index_Size, CONCAT(ROUND((sum(data_length)+sum(index_length))/(1024*1024*1024),2),'GB') Total_Size  FROM information_schema.TABLES  WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'sys')  GROUP BY NULL; 

SELECT table_schema, table_name, CONCAT(ROUND((data_free / 1024 / 1024),2),'MB') data_free  FROM information_schema.tables  WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')    AND ENGINE LIKE 'InnoDB' AND data_free > 100 * 1024 *  1024;

No comments:

Post a Comment