MySQL 数据库是否会保存超过 103,998,960,000 条记录,还是必须将其分布在多个数据库之间?
问问题
138 次
2 回答
2
这在一定程度上取决于记录的大小。行数没有限制,但数据大小有 64 TB 的限制。
如果您在该限制范围内,并且确保您的主键不会溢出(在您的情况下假设 uint 主键不会溢出),那么您会没事的。
于 2013-03-01T08:52:59.847 回答
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 源配置。
编辑:从我得到的评论中,我应该提供有关引擎方面的信息。
There is a limit of (232)2 (1.844E+19) rows in a MyISAM table.
有关MyISAM 引擎限制的更多信息。
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 引擎限制的更多信息。
理论上是的,但在现实生活中存在表大小和插入时间等限制。再次来自 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.
于 2013-03-01T08:50:40.880 回答