Skip to content

Commit c8bc874

Browse files
authored
partitioning: Corrected partition management (#5498) (#6027)
1 parent e67c799 commit c8bc874

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

partitioned-table.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,21 @@ You can see that the inserted record `(NULL, 'mothra')` falls into the same part
578578
579579
## Partition management
580580

581-
You can add, drop, merge, split, redefine partitions by using `ALTER TABLE` statements.
581+
For `LIST` and `RANGE` partitioned tables, you can add and drop partitions using the `ALTER TABLE <table name> ADD PARTITION (<partition specification>)` or `ALTER TABLE <table name> DROP PARTITION <list of partitions>` statement.
582+
583+
For `LIST` and `RANGE` partitioned tables, `REORGANIZE PARTITION` is not yet supported.
584+
585+
For `HASH` partitioned tables, `COALESCE PARTITION` and `ADD PARTITION` are not yet supported.
586+
587+
`EXCHANGE PARTITION` works by swapping a partition and a non-partitioned table, similar to how renaming a table like `RENAME TABLE t1 TO t1_tmp, t2 TO t1, t1_tmp TO t2` works.
588+
589+
For example, `ALTER TABLE partitioned_table EXCHANGE PARTITION p1 WITH TABLE non_partitioned_table` swaps the `non_partitioned_table` table in the `p1` partition with the `partitioned_table` table.
590+
591+
Ensure that all rows that you are exchanging into the partition match the partition definition; otherwise, these rows will not be found and cause unexpected issues.
592+
593+
> **Warning:**
594+
>
595+
> `EXCHANGE PARTITION` is an experimental feature. It is not recommended to use it in a production environment. To enable it, set the `tidb_enable_exchange_partition` system variable to `ON`.
582596
583597
### Range partition management
584598

0 commit comments

Comments
 (0)