gpt4 book ai didi

mysql - 如何仅更改单个表的自动增量偏移量和步长值?

转载 作者:行者123 更新时间:2023-11-29 17:36:04 26 4
gpt4 key购买 nike

我有一个整体数据库,其中有一个包含大约 6000 万行的表。该设置是主控复制的,其中一个主控写入偶数自动增量 id,其他主控写入奇数自动增量 id。

但我想更改设置,以便可以对整个数据库中的单个表(相关表)使用步长 4 和偏移量 1 和 3。有可能吗?

最佳答案

没有。

MySQL 文档明确指出,自动增量偏移量是每个 MySQL 实例的设置,并将应用于数据库上的所有表。

可以在https://dev.mysql.com/doc/refman/8.0/en/replication-options-master.html#sysvar_auto_increment_increment查看文档.

It is not possible to restrict the effects of these two variables to a single table; these variables control the behavior of all AUTO_INCREMENT columns in all tables on the MySQL server. If the global value of either variable is set, its effects persist until the global value is changed or overridden by setting the session value, or until mysqld is restarted. If the local value is set, the new value affects AUTO_INCREMENT columns for all tables into which new rows are inserted by the current user for the duration of the session, unless the values are changed during that session.

关于mysql - 如何仅更改单个表的自动增量偏移量和步长值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50279314/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com