MySQL partitioning
Here are all the stored procedures you need to create to properly handle database partitioning with MySQL.
You need to create all of them in your Zabbix database.
Note that all the procedures described here are also available at https://github.com/smartmarmot/zabbix_network_monitoring/tree/master/Chapter1.
The partition_maintenance procedure
This is the most important procedure, which will manage all the other stored procedures involved in the creation/drop and verification of partitions, as follows:
DELIMITER $$ CREATE PROCEDURE `partition_maintenance`(SCHEMA_NAME VARCHAR(32), TABLE_NAME VARCHAR(32), KEEP_DATA_DAYS INT, HOURLY_INTERVAL INT, CREATE_NEXT_INTERVALS INT) BEGIN DECLARE OLDER_THAN_PARTITION_DATE VARCHAR(16); DECLARE PARTITION_NAME VARCHAR(16); DECLARE LESS_THAN_TIMESTAMP INT; DECLARE CUR_TIME INT; CALL partition_verify(SCHEMA_NAME, TABLE_NAME, HOURLY_INTERVAL); SET CUR_TIME = UNIX_TIMESTAMP(DATE_FORMAT(NOW(), ...