Partition Management
TSDB extension engine provides scheduled policy APIs for adding and deleting partitions. You can add and delete policies for existing partitioned tables as needed. If you create a times series table, a partition management policy exists. In this case, do not add a partition policy again. If you need to modify the partition management policy, you are advised to use the time series DDL statement ALTER TABLE.
Permission check is performed on the partition management interface. Only the table owner and administrator have the permission to invoke the interface.
API Details
- Determining whether the time series engine is available.
Example:
SELECT check_engine_enable(); check_engine_enable --------------------- t (1 row)
- Check whether the time series GUC switch is enabled.
Example:
SELECT is_tsdb_enable(); is_tsdb_enable ---------------- t (1 row)
- Add a partition creation policy.
Table 1 Parameter description Parameter
Type
Description
Mandatory or Not
relationname
name
Partitioned table name
Yes
boundaries_interval
interval
Partition interval. Range:
1 hour~100 year
Yes
schedule_interval
interval
Policy execution interval. Range:
1 hour~100 year
Yes
Example:SELECT add_create_partition_policy('exmaple', interval '1 day', interval '1 day');
- Delete a partition creation policy.
remove_create_partition_policy
Table 2 Parameter description Parameter
Type
Description
Mandatory or Not
relationname
name
Partitioned table name
Yes
Example:SELECT remove_create_partition_policy('exmaple');
- Create a partition deletion policy.
Table 3 Parameter description Parameter
Type
Description
Mandatory or Not
relationname
name
Partitioned table name
Yes
older_than
interval
Data retention period
Yes
schedule_interval
interval
Policy execution interval. Range:
1 hour~100 year
No
Example:SELECT add_drop_partition_policy('exmaple', interval '7 days');
Last Article: Usage
Next Article: Time Series Function
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.