运维的时候,经常遇到auto_increment的疑惑:
1.1 innodb_autoinc_lock_mode
0: 每一个statement获取一个排他lock,直到statement结束,保证statement执行过程的id是连续的。
1: 单条确定insert影响的条数的时候,使用mutex。如果是insert select,load data这样的,使用排他lock。
2: 多条statement产生的id会穿插在一起,如果是statement复制,会产生不一致的情况。
1.2
auto_increment_increment
auto_increment_offset
控制自增的起始值和interval
/* Basic lock modes */enum lock_mode { LOCK_IS = 0, /* intention shared */ LOCK_IX, /* intention exclusive */ LOCK_S, /* shared */ LOCK_X, /* exclusive */ LOCK_AUTO_INC, /* locks the auto-inc counter of a table in an exclusive mode */ LOCK_NONE, /* this is used elsewhere to note consistent read */ LOCK_NUM = LOCK_NONE/* number of lock modes *
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号