tidb 建表的时候会分配多少个region?

SHARD_ROW_ID_BITS = 4 PRE_SPLIT_REGIONS = 4
两个参数一起用。


MySQL [test]> CREATE TABLE t (c int) SHARD_ROW_ID_BITS = 4 PRE_SPLIT_REGIONS = 4;
Query OK, 0 rows affected (0.09 sec)

MySQL [test]> show table t regions;
+-----------+------------------------------+------------------------------+-----------+-----------------+---------------------------------+------------+---------------+------------+----------------------+------------------+
| REGION_ID | START_KEY                    | END_KEY                      | LEADER_ID | LEADER_STORE_ID | PEERS                           | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS |
+-----------+------------------------------+------------------------------+-----------+-----------------+---------------------------------+------------+---------------+------------+----------------------+------------------+
| 111570150 | t_2873_                      | t_2873_r_576460752303423488  | 111570151 |       110997197 | 111570151, 111570152, 111570153 |          0 |             0 |          0 |                    1 |                0 |
| 111570154 | t_2873_r_576460752303423488  | t_2873_r_1152921504606846976 | 111570155 |       110997197 | 111570155, 111570156, 111570157 |          0 |             0 |          0 |                    1 |                0 |
| 111570158 | t_2873_r_1152921504606846976 | t_2873_r_1729382256910270464 | 111570159 |       110997197 | 111570159, 111570160, 111570161 |          0 |             0 |          0 |                    1 |                0 |
| 111570162 | t_2873_r_1729382256910270464 | t_2873_r_2305843009213693952 | 111570163 |       110997197 | 111570163, 111570164, 111570165 |          0 |            39 |          0 |                    1 |                0 |
| 111570166 | t_2873_r_2305843009213693952 | t_2873_r_2882303761517117440 | 111570167 |       110997197 | 111570167, 111570168, 111570169 |          0 |            39 |          0 |                    1 |                0 |
| 111570170 | t_2873_r_2882303761517117440 | t_2873_r_3458764513820540928 | 111570171 |       110997197 | 111570171, 111570172, 111570173 |          0 |            39 |          0 |                    1 |                0 |
| 111570174 | t_2873_r_3458764513820540928 | t_2873_r_4035225266123964416 | 111570175 |       110997197 | 111570175, 111570176, 111570177 |          0 |            39 |          0 |                    1 |                0 |
| 111570178 | t_2873_r_4035225266123964416 | t_2873_r_4611686018427387904 | 111570179 |       110997197 | 111570179, 111570180, 111570181 |          0 |            39 |          0 |                    1 |                0 |
| 111570182 | t_2873_r_4611686018427387904 | t_2873_r_5188146770730811392 | 111570183 |       110997197 | 111570183, 111570184, 111570185 |          0 |            39 |          0 |                    1 |                0 |
| 111570186 | t_2873_r_5188146770730811392 | t_2873_r_5764607523034234880 | 111570187 |       110997197 | 111570187, 111570188, 111570189 |          0 |            39 |          0 |                    1 |                0 |
| 111570190 | t_2873_r_5764607523034234880 | t_2873_r_6341068275337658368 | 111570191 |       110997197 | 111570191, 111570192, 111570193 |          0 |            27 |          0 |                    1 |                0 |
| 111570194 | t_2873_r_6341068275337658368 | t_2873_r_6917529027641081856 | 111570195 |       110997197 | 111570195, 111570196, 111570197 |          0 |            27 |          0 |                    1 |                0 |
| 111570198 | t_2873_r_6917529027641081856 | t_2873_r_7493989779944505344 | 111570199 |       110997197 | 111570199, 111570200, 111570201 |          0 |            39 |          0 |                    1 |                0 |
| 111570202 | t_2873_r_7493989779944505344 | t_2873_r_8070450532247928832 | 111570203 |       110997197 | 111570203, 111570204, 111570205 |          0 |            39 |          0 |                    1 |                0 |
| 111570206 | t_2873_r_8070450532247928832 | t_2873_r_8646911284551352320 | 111570207 |       110997197 | 111570207, 111570208, 111570209 |          0 |            39 |          0 |                    1 |                0 |
| 111528001 | t_2873_r_8646911284551352320 |                              | 111528003 |       110997197 | 111528003, 111528505, 111530519 |          0 |             0 |          0 |                    1 |                0 |
+-----------+------------------------------+------------------------------+-----------+-----------------+---------------------------------+------------+---------------+------------+----------------------+------------------+
16 rows in set (0.02 sec)