如何检查指定 MySQL 数据库中的表大小?


我们已经检查了 MySQL 数据库的大小,同样我们也可以检查指定数据库中表的大小。具体做法如下 −

mysql> SELECT
    -> table_name AS "Table",
    -> round(((data_length + index_length) / 1024 / 1024), 2) as SIZE
    -> FROM information_schema.TABLES
    -> WHERE table_schema = "SAMPLE"
    -> ORDER BY SIZE;
+-------------+-------+
| Table       | SIZE  |
+-------------+-------+
| employee    | 0.02  |
| student     | 0.02  |
| new_student | 0.02  |
+-------------+-------+
3 rows in set (0.00 sec)

此输出给出了Sample 数据库中三张表的大小。

更新于: 2020-01-28

263 次浏览

开启你的 职业生涯

完成课程取证并获得认证

开始学习
广告
© . All rights reserved.