数据库大小计算? [英] Database size calculation?
本文介绍了数据库大小计算?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
估计具有以下特征的数据库的大小的最准确方法是什么:
What is the most accurate way to estimate how big a database would be with the following characteristics:
- MySQL
- 1个包含三列的表:
- id->大整数)
- field1-> varchar 32
- field2->字符32
- MySQL
- 1 Table with three columns:
- id --> big int)
- field1 --> varchar 32
- field2 --> char 32
您可以假定varchar 32已完全填充(全部32个字符).如果每个字段都填充并且有:
You can assume varchar 32 is fully populated (all 32 characters). How big would it be if each field is populated and there are:
- 一百万行
- 500万行
- 十亿行
- 50亿行
我的粗略估算得出:id为1字节,其他两个字段各为32位.大致说明:
My rough estimate works out to: 1 byte for id, 32 bits each for the other two fields. Making it roughly:
1 + 32 + 32 = 65 * 1 000 000 = 65 million bytes for 1 million rows = 62 Megabyte
因此:
- 62 Mb
- 310 Mb
- 310 000 Mb = +-302Gb
- 1 550 000 Mb = 1513 Gb
这是一个准确的估计吗?
Is this an accurate estimation?
推荐答案
如果您想知道数据库的当前大小,可以尝试以下操作:
If you want to know the current size of a database you can try this:
SELECT table_schema "Database Name" , SUM(data_length + index_length) / (1024 * 1024) "Database Size in MB" FROM information_schema.TABLES GROUP BY table_schema
这篇关于数据库大小计算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文