查看数据库的某个表的大小
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "<DB>"
ORDER BY (data_length + index_length) DESC;
查看数据库的大小
select round(sum(data_length/1024/1024),2) 'Data Size in MB',
round(sum(index_length/1024/1024),2) 'Index Size in MB',
round(sum((index_length + data_length)/1024/1024),2) 'All Size in MB'
FROM information_schema.TABLES where table_schema='<DB>';
把 <DB>
替换成需要查询的数据库名, 只在 Mysql / MariaDB运行过.
网友评论