问题描述
我有几个表,我在其中创建了一个对象 ID 为 Int 或 Bigint,在这两种情况下,它们似乎自动递增 10(即,第一个插入是对象 ID 1,第二个是对象 ID 11,第三个是对象 ID 21,等等).两个问题:
I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc). Two questions:
为什么要这样做?
Why does it do that?
有问题吗?
推荐答案
请不要更改auto_increment_increment
.ClearDB 是故意这样做的.文档中对此进行了解释:
Please do not change the auto_increment_increment
. ClearDB is doing this on purpose. It's explained in the documentation:
ClearDB 使用循环复制提供主-主 MySQL支持.因此,某些东西,例如 auto_increment 键(或序列)必须配置,以便一个主站不使用在所有情况下,与另一个相同的密钥.我们通过配置 MySQL 来做到这一点跳过某些键,并强制 MySQL 使用特定的偏移量对于每个使用的键.我们使用值 10 而不是 2 的原因是为未来的发展.
ClearDB uses circular replication to provide master-master MySQL support. As such, certain things such as auto_increment keys (or sequences) must be configured in order for one master not to use the same key as the other, in all cases. We do this by configuring MySQL to skip certain keys, and by enforcing MySQL to use a specific offset for each key used. The reason why we use a value of 10 instead of 2 is for future development.
这篇关于MySQL 自动增量列跳了 10-为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!