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-为什么?


基础教程推荐
- SQL Server 2016更改对象所有者 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01