Mysql日常记录

-
-
2025-07-31 14:00

查询表占用情况 

SELECT
table_schema AS '数据库',
table_name AS '表名',
a.TABLE_TYPE,
a.`ENGINE`,
a.CREATE_TIME,
a.UPDATE_TIME,
a.TABLE_COLLATION,
table_rows AS '记录数',
TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '数据容量(MB)',
TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)',
TRUNCATE ( ( data_length + index_length ) / 1024 / 1024, 2 ) AS '总大小(MB)'
FROM information_schema.TABLES a
ORDER BY ( data_length + index_length ) DESC
LIMIT 10;

 


WhoCare
随时发疯
公告

这是一个疯子的自白
最新评论

加载中...