Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm-best-practices: Update for MySQL Compatible AUTO_INCREMENT #18904

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dm/dm-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ DM 的性能参数如下表所示。

TiDB 的 `AUTO_INCREMENT` 与 MySQL 的 `AUTO_INCREMENT` 整体上看是相互兼容的。但因为 TiDB 作为分布式数据库,一般会有多个计算节点(client 端入口),应用数据写入时会将负载均分开,这就导致在有 `AUTO_INCREMENT` 列的表上,可能出现不连续的自增 ID。详细原理参考 [`AUTO_INCREMENT`](/auto-increment.md#实现原理)

如果业务对自增 ID 有强依赖,可以考虑使用 [SEQUENCE 函数](/sql-statements/sql-statement-create-sequence.md#sequence-函数)
如果业务对自增 ID 有强依赖,可以考虑使用 [`AUTO_INCREMENT` 的 MySQL 兼容模式](/auto-increment.md#mysql-兼容模式)[`SEQUENCE` 函数](/sql-statements/sql-statement-create-sequence.md#sequence-函数)

#### 是否使用聚簇索引

Expand Down