Skip to content

Commit

Permalink
Update partitioned-table.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxsd authored and ti-chi-bot committed Dec 25, 2024
1 parent cc11399 commit 71cd9d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion partitioned-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ ALTER TABLE t1 PARTITION BY HASH (col1) PARTITIONS 3 UPDATE INDEXES (uidx12 LOCA

- If the `GLOBAL` keyword is not explicitly specified in the index definition, TiDB creates a local index by default.
- The `GLOBAL` and `LOCAL` keywords only apply to partitioned tables and do not affect non-partitioned tables. In other words, there is no difference between a global index and a local index in non-partitioned tables.
- Currently, TiDB only supports creating unique global indexes. If you need to create a global index on a non-unique column, the global index must include a primary key to create a composite index. For example, if the non-unique column is `col3` and the primary key is `col1`, you can use the following statement to create a global index on the non-unique column `col3`:
- Currently, TiDB only supports creating unique global indexes on unique columns. If you need to create a global index on a non-unique column, you can include a primary key in the global index to create a composite index. For example, if the non-unique column is `col3` and the primary key is `col1`, you can use the following statement to create a global index on the non-unique column `col3`:

```sql
ALTER TABLE ... ADD UNIQUE INDEX(col3, col1) GLOBAL;
Expand Down

0 comments on commit 71cd9d5

Please sign in to comment.