1.Check Database Size
SELECT table_schema "database", sum(data_length + index_length)/1024/1024/1024 "size in GB" FROM information_schema.TABLES
GROUP BY table_schema;
SELECT table_schema "database", sum(data_length + index_length)/1024/1024 "size in MB" FROM information_schema.TABLES
where table_schema in()
GROUP BY table_schema;
SELECT u.table_name FROM information_schema.TABLES AS u
WHERE table_schema = " '' AND NOT EXISTS(SELECT v.table_name FROM information_schema.TABLES AS v WHERE u.table_name = v.table_name
AND v.table_schema = '' ");
3.Compare Columns of tables
SELECT u.table_name,COUNT(DISTINCT u.column_name) AS col1 ,COUNT(DISTINCT v.column_name) AS col2 FROM information_schema.COLUMNS AS u
JOIN information_schema.COLUMNS AS v
ON u.table_name = v.table_name
WHERE u.table_schema = ""
AND v.table_schema =""
GROUP BY u.table_name,v.table_name
HAVING col1!=col2
Kindly, Put your database name in table_schema condition.
Hope this post is useful !
0 comments:
Post a Comment