我有几个表,在其中创建了一个 Int 或 Bigint 类型的对象 ID,在这两种情况下,它们似乎都会自动递增 10(即,第一个插入是对象 ID 1,第二个插入是对象 ID 11) ,第三个是对象 ID 21,等等)。两个问题:
为什么要这样做?
这是一个问题吗?
最佳答案
请不要更改auto_increment_increment
。 ClearDB 是故意这样做的。 the documentation 中对此进行了解释:
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-为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37577099/