INTERVAL RANGE
Scenarios
An INTERVAL RANGE partitioned table is an extension of a RANGE partitioned table. If data to be inserted into a RANGE partitioned table falls outside the range of an existing partition, it cannot be inserted and an error will be returned.
If there is an INTERVAL RANGE partitioned table in a database, the database can create a partition based on rules specified by the INTERVAL clause when data to be inserted exceeds the range of an existing partition.
Prerequisites
- The kernel version of your TaurusDB instance must be 2.0.54.240600 or later. For details about how to check the kernel version, see How Can I Check the Version of a TaurusDB Instance?
- rds_interval_range_enabled has been set to ON.
Constraints
- INTERVAL RANGE partitioned tables support only HASH or KEY subpartitions.
- If an INTERVAL RANGE rule is in RANGE COLUMNS(column_list) INTERVAL([type], value) format:
- column_list specifies only a single partition key, which must be of the INTEGER, DATE, TIME, or DATETIME type.
- If the partition key is of the INTEGER type, the interval type (type) can be left blank.
- If the partition key is of the DATE type, the interval type (type) can only be YEAR, QUARTER, MONTH, WEEK, or DAY.
- If the partition key is of the TIME type, the interval type (type) can only be HOUR, MINUTE, or SECOND.
- If the partition key is of the DATETIME type, the interval type (type) can be YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, or SECOND.
- The interval value (value) must be a positive integer.
- If the interval type (type) is SECOND, the interval cannot be less than 60.
- If an INTERVAL RANGE rule is in RANGE(expr) INTERVAL(value) format, expr must be an integer, and value must be a positive integer.
- You cannot execute the INSERT ... SELECT, INSERT ... ON DUPLICATE KEY UPDATE, and UPDATE statements to add partitions.
- When you execute the LOAD DATA statement to import data, automatic partition creation will not be triggered. (If the range of the partition covers all data, data can be imported. If the range of the partition does not cover all data, automatic partition creation will not be triggered and data cannot be imported.)
- Partitions cannot be added in explicit transactions or in SQL statements following set autocommit=0.
- Prefix _p is reserved for automatically created partitions. If you use this prefix for custom partitions, automatic partition creation may fail.
- The SET INTERVAL([type], value) clause applies only to INTERVAL RANGE and RANGE partitioned tables. If these tables have subpartitions, the subpartitions must be of the HASH or KEY type.
- The values of type and value in the SET INTERVAL([type], value) clause must be restricted by the partition expression expr or the partition key column_list of the original table.
How to Use
| Parameter | Level | Description |
|---|---|---|
| rds_interval_range_enabled | Global | Enables or disables INTERVAL RANGE. Value:
|
Creating an INTERVAL RANGE Partitioned Table
The definition format of an INTERVAL RANGE partitioned table is similar to that of a RANGE partitioned table. The only difference is that the INTERVAL clause is added.
Conversion Between INTERVAL RANGE Partitioned Tables and Other Types of Tables
Other types of tables can be converted to INTERVAL RANGE partitioned tables, and vice versa.
SET INTERVAL Clause Usage
You can use the SET INTERVAL clause to modify the interval type and value of the INTERVAL clause defined in the INTERVAL RANGE partitioned table, or eliminate or add the INTERVAL clause.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot