MySQL autoincrement column jumps by 10- why?(MySQL 自动增量列跳了 10-为什么?)
问题描述
我有几个表,我在其中创建了一个对象 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-为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 自动增量列跳了 10-为什么?


基础教程推荐
- 带有WHERE子句的LAG()函数 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01