在mysql中按大小列出数据库顺序中所有表的查询是什么?
答案 0 :(得分:70)
试试这个......
SELECT TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "schema_name"
ORDER BY (data_length + index_length) DESC;
问候。
答案 1 :(得分:3)
在mysql客户端
中运行以下查询<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/css")
</head>
<body>
@{Html.RenderPartial("_NavBar");}
<div class="container" id="MainBody">
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", false)
</body>
</html>
答案 2 :(得分:0)
在information_schema数据库中执行以下查询:
SELECT table_schema AS "Database name",
SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema
ORDER BY (SUM(data_length + index_length) / 1024 / 1024) DESC;