Batch/Automatic Partition Table Creation

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 批量/自动建分区表

| username: atidat

When specifying a partition key while creating a table, it is common to define the business time column as the partition key. As the business progresses, the value of this time column will continue to increase. At this point, you would want to generate a new partition rather than categorizing it into the partition where MAXVAL is located.

CREATE TABLE `device_machine_sec_detail_v2` ( my_datetime TIMESTAMP )
PARTITION BY RANGE(UNIX_TIMESTAMP(`my_datetime`)) 
(
PARTITION p2022_46 VALUES LESS THAN (UNIX_TIMESTAMP('2022-11-16 00:00:00')),
PARTITION p2022_47 VALUES LESS THAN (UNIX_TIMESTAMP('2022-11-23 00:00:00')),
PARTITION p2021_53 VALUES LESS THAN (MAXVALUE)
);

That is, I want to know if it supports:

  1. Specifying the start time, end time, and partition split frequency when creating a table (similar to the capability of StarRocks)
PARTITION BY RANGE (datekey) (
    START ("2021-01-01") END ("2021-01-04") EVERY (INTERVAL 1 day)
)
  1. TiDB automatically generating a new range partition when the partition key in an insert exceeds the range of the current maximum partition.
| username: TiDBer_jYQINSnf | Original post link

Version 6.3 supports new syntax, which should partially meet your needs.

Automatic creation when exceeded is not available.

| username: atidat | Original post link

Awesome!

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.