新版的tidb支持普通表转分区表吗?

最新版本 7.4.0 已经支持了。

mysql> show create table t2;
+-------+------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                               |
+-------+------------------------------------------------------------------------------------------------------------+
| t2    | CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> alter table t2 partition by range (a) (   PARTITION p0 VALUES LESS THAN (18),   PARTITION p1 VALUES LESS THAN (30),   PARTITION p2 VALUES LESS THAN (MAXVALUE) );
Query OK, 0 rows affected, 1 warning (0.50 sec)

*************************** 1. row ***************************
       Table: t2
Create Table: CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN (18),
 PARTITION `p1` VALUES LESS THAN (30),
 PARTITION `p2` VALUES LESS THAN (MAXVALUE))
1 row in set (0.00 sec)
1 个赞