MySQL自动增量列跳跃10-为什么?

标签 mysql

我有几个表,在其中创建了一个 Int 或 Bigint 类型的对象 ID,在这两种情况下,它们似乎都会自动递增 10(即,第一个插入是对象 ID 1,第二个插入是对象 ID 11) ,第三个是对象 ID 21,等等)。两个问题:

  1. 为什么要这样做?

  2. 这是一个问题吗?

最佳答案

请不要更改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/

相关文章:

好友列表的 SQL 加入帮助

java - 是否可以将java应用程序连接到在线数据库

mysql - 如何在 MySQL 中排除周末和节假日日期并查找预期日期?

java - 通过JAVA远程连接MySql(CPanel)

mysql - 在 SQL 中从单词开头搜索字母

php - 一种覆盖所有串联组合的简单方法

Python:Flask request.args.get 表中包含空值

mysql - 大型Mysql连接

mysql - 如何从 MySQL 控制台切换到新用户

php - mySQL 和 PHP 循环