MySQL数据库可以保存103,998,960,000条记录吗?

时间:2013-03-01 08:41:14

标签: mysql database

MySQL数据库是否会保留103,998,960,000条记录,还是必须在多个数据库之间传播?

2 个答案:

答案 0 :(得分:2)

这取决于记录的大小。行数没有限制,但数据大小限制为64 TB。

如果你在这个限制范围内并且你确保你的主键不会溢出(在你假设一个uint主键的情况下不会溢出)那么你就没事了。

答案 1 :(得分:1)

如果表格大小无关紧要,您可以使用非常多的行数。来自mysql文档。

It is possible to build MySQL with large table support using 
the --with-big-tables option.

This option causes the variables that store table row counts to be declared as 
unsigned long long rather than unsigned long. This enables tables to hold up 
to approximately 1.844E+19 ((232)2) rows rather than 232 (~4.295E+09) rows. 
Previously it was necessary to pass -DBIG_TABLES to the compiler manually 
in order to enable this feature.

了解更多信息MySQL Source configuration.

编辑:从评论中得到我应该提供有关引擎的信息。

There is a limit of (232)2 (1.844E+19) rows in a MyISAM table.

有关MyISAM engine limit

的详细信息
The InnoDB internal maximum key length is 3500 bytes, but MySQL itself 
restricts this to 3072 bytes. This limit applies to the length of 
the combined index key in a multi-column index.

有关InnoDB engine limit

的详细信息

理论上是,但在现实生活中存在诸如表格大小和插入时间之类的限制。再次从MySQL文档中获取。

When an AUTO_INCREMENT column runs out of values, InnoDB wraps a BIGINT 
to -9223372036854775808 and BIGINT UNSIGNED to 1. However, BIGINT values 
have 64 bits, so if you were to insert one million rows per second, it would 
still take nearly three hundred thousand years before BIGINT reached its upper bound.
With all other integer type columns, a duplicate-key error results. This is general 
MySQL behavior, similar to how MyISAM works.