doc-exports/docs/dws/dev/dws_06_0304.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

4.3 KiB
Raw Permalink Blame History

Partition Management Function

proc_add_partition (relname regclass, boundaries_interval interval)

Description: Adds partitions to a table with the automatic partition creation function enabled.

Return type: void

Note: When the function is executed, multiple partitions with time range as boundaries_interval are created based on the existing partition boundary until new_part_boundary now_time >= 29 * boundaries_interval. Then, an extra partition is created to ensure that at least a new partition is created when the function is executed.

Example:

1
2
3
4
5
call proc_add_partition('my_schema.my_table', interval '1 day');
 proc_add_partition
--------------------

(1 row)

proc_drop_partition (relname regclass, older_than interval)

Description: Deletes partitions from a table with the automatic partition deletion function enabled.

Return type: void

Note: When this function is executed, all partitions in the table are traversed and the partitions whose boundary is smaller than now_time - older_than are deleted. If all partitions meet the deletion condition, the table is truncated with one partition kept.

Example:

1
2
3
4
5
call proc_drop_partition('my_schema.my_table', interval '7 day');
 proc_drop_partition
--------------------

(1 row)