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

mysqlmysqli database更新于 2025/3/31 8:44:17

正如我们检查了 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数据库中三个表的大小。


相关文章


有用资源