MySQL中如何查看数据库表容量大小
今天就跟大家聊聊有关MySQL中如何查看数据库表容量大小,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
创新互联专业为企业提供白银网站建设、白银做网站、白银网站设计、白银网站制作等企业网站建设、网页设计与制作、白银企业网站模板建站服务,十年白银做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
1、查看所有数据库容量大小
SELECT table_schema AS '数据库', sum( table_rows ) AS '记录数', sum( TRUNCATE ( data_length / 1024 / 1024, 2 ) ) AS '数据容量(MB)', sum( TRUNCATE ( index_length / 1024 / 1024, 2 ) ) AS '索引容量(MB)' FROM information_schema.TABLES GROUP BY table_schema ORDER BY sum( data_length ) DESC, sum( index_length ) DESC;
2、查看所有数据库各表容量大小
SELECT table_schema AS '数据库', table_name AS '表名', table_rows AS '记录数', TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '数据容量(MB)', TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)' FROM information_schema.TABLES ORDER BY data_length DESC, index_length DESC;
3、查看指定数据库容量大小
SELECT table_schema AS '数据库', sum( table_rows ) AS '记录数', sum( TRUNCATE ( data_length / 1024 / 1024, 2 ) ) AS '数据容量(MB)', sum( TRUNCATE ( index_length / 1024 / 1024, 2 ) ) AS '索引容量(MB)' FROM information_schema.TABLES WHERE table_schema = 'mysql';
4、查看指定数据库各表容量大小
SELECT table_schema AS '数据库', table_name AS '表名', table_rows AS '记录数', TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '数据容量(MB)', TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)' FROM information_schema.TABLES WHERE table_schema = 'mysql' ORDER BY data_length DESC, index_length DESC;
[object Object]
看完上述内容,你们对MySQL中如何查看数据库表容量大小有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
本文标题:MySQL中如何查看数据库表容量大小
网站链接:http://azwzsj.com/article/jihods.html