MySQL:如何获取表大小?

如何获取 MySQL 表的大小

特定表的尺寸:

SELECT
	table_name AS `Table`,
	round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM
	information_schema.TABLES
WHERE
	table_schema = 'db_name'
	AND table_name = 'table_name';

所有表的尺寸,由大到小:

SELECT
	table_schema AS `Database`,
	table_name AS `Table`,
	round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM
	information_schema.TABLES
ORDER BY
	(data_length + index_length)
	DESC;

想为 MySQL 找一款好用的图形工具?TablePlus 是一款界面简洁的现代原生工具,可以同时管理 MySQL、PostgreSQL、SQLite、Microsoft SQL Server 等多个数据库。

下载适用于 Mac 的 TablePlus.

不在 Mac 上? 下载 TablePlus for Windows.

使用 Linux? 下载适用于 Linux 的 TablePlus

需要在外出时快速编辑数据? 下载适用于 iOS 的 TablePlus.

TablePlus 中的 MySQL 数据表

← 所有文章