gpt4 book ai didi

mysql - 如何获取 MySQL 数据库的真实大小?

转载 作者:IT老高 更新时间:2023-10-28 12:49:35 25 4
gpt4 key购买 nike

我想知道我的 MySQL 数据库使用了多少空间,以便选择一个网络主机。我找到了命令 SHOW TABLE STATUS LIKE 'table_name' 所以当我进行查询时,我会得到这样的结果:

Name       | Rows | Avg. Row Length | Data_Length | Index Length
---------- ---- --------------- ----------- ------------
table_name 400 55 362000 66560
  • 数字四舍五入。

那么我有 362000 或 400*362000 = 144800000 字节的数据用于此表吗?索引长度是什么意思?谢谢!

最佳答案

来自 S. Prakash,位于 MySQL forum :

SELECT table_schema "database name",
sum( data_length + index_length ) / 1024 / 1024 "database size in MB",
sum( data_free )/ 1024 / 1024 "free space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;

或者在一行中更容易复制粘贴:

SELECT table_schema "database name", sum( data_length + index_length ) / 1024 / 1024 "database size in MB", sum( data_free )/ 1024 / 1024 "free space in MB" FROM information_schema.TABLES GROUP BY table_schema; 

关于mysql - 如何获取 MySQL 数据库的真实大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14714750/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com