TiDB 创建预分区的表后主键并没有分区?

下面的表在创建后,row data 被 pre split 了,符合预期,为啥 primary index 没有被 pre split?

MySQL [test]> select version();
+--------------------+
| version()          |
+--------------------+
| 5.7.25-TiDB-v4.0.1 |
+--------------------+
1 row in set (0.00 sec)

MySQL [test]> show create table t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `account3_id` bigint(20) NOT NULL,
  `txn_account_id` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `cal_date` date NOT NULL,
  `broker` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL,
  `fof_nav` decimal(22,8) DEFAULT NULL,
  `fof_input_share` decimal(22,8) DEFAULT NULL,
  `fof_output_share` decimal(22,8) DEFAULT NULL,
  `fof_holding_share` decimal(22,8) DEFAULT NULL,
  `fof_holding_cost` decimal(22,8) DEFAULT NULL,
  `fof_holding_unit` decimal(22,8) DEFAULT NULL,
  `fof_holding_profit` decimal(22,8) DEFAULT NULL,
  `fof_holding_profit_rate` decimal(22,8) DEFAULT NULL,
  PRIMARY KEY (`account3_id`,`txn_account_id`,`cal_date`,`broker`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci/*!90000 SHARD_ROW_ID_BITS=4 PRE_SPLIT_REGIONS=4 */
1 row in set (0.00 sec)

MySQL [test]> show table asset_ca_gbc_fof regions;
+-----------+-------------------------------+-------------------------------+-----------+-----------------+---------------------------+------------+---------------+------------+----------------------+------------------+
| REGION_ID | START_KEY                     | END_KEY                       | LEADER_ID | LEADER_STORE_ID | PEERS                     | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS |
+-----------+-------------------------------+-------------------------------+-----------+-----------------+---------------------------+------------+---------------+------------+----------------------+------------------+
|   7027212 | t_14798_i_1_                  | t_14798_r_576460752303423488  |   7027213 |         3553218 | 7027213, 7027214, 7027215 |          0 |             0 |          0 |                    1 |                0 |
|   7027216 | t_14798_r_576460752303423488  | t_14798_r_1152921504606846976 |   7027217 |         3553218 | 7027217, 7027218, 7027219 |          0 |             0 |          0 |                    1 |                0 |
|   7027220 | t_14798_r_1152921504606846976 | t_14798_r_1729382256910270464 |   7027221 |         3553218 | 7027221, 7027222, 7027223 |          0 |             0 |          0 |                    1 |                0 |
|   7027224 | t_14798_r_1729382256910270464 | t_14798_r_2305843009213693952 |   7027225 |         3553218 | 7027225, 7027226, 7027227 |          0 |             0 |          0 |                    1 |                0 |
|   7027228 | t_14798_r_2305843009213693952 | t_14798_r_2882303761517117440 |   7027229 |         3553218 | 7027229, 7027230, 7027231 |          0 |             0 |          0 |                    1 |                0 |
|   7027232 | t_14798_r_2882303761517117440 | t_14798_r_3458764513820540928 |   7027233 |         3553218 | 7027233, 7027234, 7027235 |          0 |             0 |          0 |                    1 |                0 |
|   7027236 | t_14798_r_3458764513820540928 | t_14798_r_4035225266123964416 |   7027237 |         3553218 | 7027237, 7027238, 7027239 |          0 |             0 |          0 |                    1 |                0 |
|   7027240 | t_14798_r_4035225266123964416 | t_14798_r_4611686018427387904 |   7027241 |         3553218 | 7027241, 7027242, 7027243 |          0 |             0 |          0 |                    1 |                0 |
|   7027244 | t_14798_r_4611686018427387904 | t_14798_r_5188146770730811392 |   7027245 |         3553218 | 7027245, 7027246, 7027247 |          0 |             0 |          0 |                    1 |                0 |
|   7027248 | t_14798_r_5188146770730811392 | t_14798_r_5764607523034234880 |   7027249 |         3553218 | 7027249, 7027250, 7027251 |          0 |             0 |          0 |                    1 |                0 |
|   7027252 | t_14798_r_5764607523034234880 | t_14798_r_6341068275337658368 |   7027253 |         3553218 | 7027253, 7027254, 7027255 |          0 |             0 |          0 |                    1 |                0 |
|   7027256 | t_14798_r_6341068275337658368 | t_14798_r_6917529027641081856 |   7027257 |         3553218 | 7027257, 7027258, 7027259 |          0 |             0 |          0 |                    1 |                0 |
|   7027260 | t_14798_r_6917529027641081856 | t_14798_r_7493989779944505344 |   7027261 |         3553218 | 7027261, 7027262, 7027263 |          0 |             0 |          0 |                    1 |                0 |
|   7027264 | t_14798_r_7493989779944505344 | t_14798_r_8070450532247928832 |   7027265 |         3553218 | 7027265, 7027266, 7027267 |          0 |             0 |          0 |                    1 |                0 |
|   7027268 | t_14798_r_8070450532247928832 | t_14798_r_8646911284551352320 |   7027269 |         3553218 | 7027269, 7027270, 7027271 |          0 |             0 |          0 |                    1 |                0 |
|         2 | t_14798_r_8646911284551352320 |                               |   7020964 |         3553218 | 7020964, 7024101, 7024342 |          0 |             0 |          0 |                    1 |                0 |
+-----------+-------------------------------+-------------------------------+-----------+-----------------+---------------------------+------------+---------------+------------+----------------------+------------------+
16 rows in set (0.01 sec)

PRE_SPLIT_REGIONS 只影响有 SHARD_ROW_ID_BITS 的 rowid。
如果要 split primary index 可以参考一下 https://docs.pingcap.com/zh/tidb/stable/sql-statement-split-region#split-index-region

我试验过,但 primary key 没有索引名字,没法对主键索引 pre-split。

是有名字的,就叫 primary,只是需要用 `` 包一下,格式就像下面这样

split table xxx index `primary` ...

高端大气上档次,我咋就没想到是这个名字:sweat:

非常感谢!:rofl: