mysql 查看表大小
时间: 2023-07-26 08:44:04 浏览: 60
要查看 MySQL 数据库中表的大小,可以使用以下 SQL 命令:
```
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "[database_name]"
ORDER BY (data_length + index_length) DESC;
```
其中,`[database_name]` 部分需要替换成要查询的数据库名称。
执行以上命令后,MySQL 数据库会返回一个表格,其中包含了查询的数据库中所有表的名称和大小,以 MB 为单位。
相关问题
MySQL查看表大小命令
你可以使用以下命令查看MySQL中的表大小:
```
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "your_database_name"
ORDER BY (data_length + index_length) DESC;
```
将 `your_database_name` 替换为你想要查看表大小的数据库名称。这个命令将返回该数据库中每个表的名称和其大小(以MB为单位),并按大小排序。
mysql查看各表空间大小
您可以使用以下SQL语句查看MySQL中各表的空间大小:
```
SELECT table_name AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "{your_database_name}"
ORDER BY (data_length + index_length) DESC;
```
请将 {your_database_name} 替换为您的数据库名称。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)