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

partition: add doc for global index #18217

Merged
merged 15 commits into from
Aug 19, 2024
Prev Previous commit
Next Next commit
Update partitioned-table.md
  • Loading branch information
hfxsd authored Aug 13, 2024
commit f30eec705f6f17cd9daa7a1fe00a40714878d663
2 changes: 1 addition & 1 deletion partitioned-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ ERROR 1503 (HY000): A UNIQUE INDEX must include all columns in the table's parti

hfxsd marked this conversation as resolved.
Show resolved Hide resolved
如果你需要创建的唯一索引**不包含分区表达式中使用的所有列**,可以通过启用 [`tidb_enable_global_index`](/system-variables.md#tidb_enable_global_index-从-v760-版本开始引入) 系统变量来实现。

以前,分区表上的索引是为每个分区创建的,因此有一个限制,即所有唯一键都需要包含所有分区列。唯一性只能在每个分区内强制执行。全局索引将在表级别创建,因此无论分区如何,它都可以强制执行唯一性。注意,全局索引对分区管理有影响,`DROP`、`TRUNCATE` 和 `REORGANIZE PARTITION` 也需要管理表级全局索引。
以前,分区表上的索引是为每个分区创建的,因此有一个限制,即所有唯一键都需要包含所有分区键。唯一性只能在每个分区内强制执行。全局索引将在表级别创建,因此无论分区如何,它都可以强制执行唯一性。注意,全局索引对分区管理有影响,`DROP`、`TRUNCATE` 和 `REORGANIZE PARTITION` 也需要管理表级全局索引。

启用该变量后,任何不符合前述约束条件的唯一索引都将自动成为全局索引。

Expand Down