mysql如何查询数据库容量
本篇内容介绍了“mysql如何查询数据库容量”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
mysql查询数据库容量的方法:1、打开DOS窗口,然后进入mysql的bin目录下;2、执行“SELECT table_schema AS 'shujuku',table_name AS 'biaoming',table_rows AS 'jilushu',TRUNCATE (data_length / 1024 / 1024, 2) ...”语句即可查看所有数据库各表容量。
MySql查看数据库及表容量并排序查看所有数据库容量
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;
查看所有数据库各表容量
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;
查看指定数据库容量
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 = 'your_table_name';
查看指定数据库各表容量
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 = '指定的库名'
ORDER BY
data_length DESC,
index_length DESC;
“mysql如何查询数据库容量”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注蜗牛博客网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:niceseo99@gmail.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
评论