This is yet another way for partitioning PostgreSQL relations.
The code is a result of playing around with PL/pgSQL and is inspired by the the solution provided in the Wiki.
Usage:
The code is a result of playing around with PL/pgSQL and is inspired by the the solution provided in the Wiki.
Usage:
Code:
SELECT create_zbx_partitions(); -- Create partitions for next month SELECT create_zbx_partitions(2); -- Create partitions for the next-but-one month SELECT create_zbx_partitions(-10,12); -- Create partitions beginning from 10 month ago to next-but-one month SELECT list_zbx_partitions(); -- List partition for current month SELECT list_zbx_partitions(2); -- List partitions for the next-but-one month SELECT list_zbx_partitions(-10,12); -- List partitions beginning from 10 month ago to next-but-one month SELECT drop_zbx_partitions(); -- Drop partitions for last month SELECT drop_zbx_partitions(2); -- Drop partitions for the next-but-one month SELECT drop_zbx_partitions(-10,12); -- Drop partitions beginning from 10 month ago to next-but-one month

Comment