You can use this query to show the size of a table (although you need to substitute the variables first):
(您可以使用此查询来显示表的大小(尽管您需要先替换变量):)
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";
or this query to list the size of every table in every database, largest first:
(或者此查询列出每个数据库中每个表的大小,最大的第一个:)
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;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…