create database zabbix default character set utf8;
CREATE TABLE `history` (
`itemid` bigint(20) unsigned NOT NULL,
`clock` int(11) NOT NULL DEFAULT '0',
`value` double(16,4) NOT NULL DEFAULT '0.0000',
`ns` int(11) NOT NULL DEFAULT '0',
primary KEY `history_1` (`itemid`,`clock`),
KEY `history_2` (`clock`,`itemid`)
) ENGINE=tokudb DEFAULT CHARSET=utf8
partition by range(clock)
(
partition p201501 VALUES LESS THAN(UNIX_TIMESTAMP('2015-02-01 00:00:00')),
partition p201502 VALUES LESS THAN(UNIX_TIMESTAMP('2015-03-01 00:00:00')),
partition p201503 VALUES LESS THAN(UNIX_TIMESTAMP('2015-04-01 00:00:00')),
partition p201504 VALUES LESS THAN(UNIX_TIMESTAMP('2015-05-01 00:00:00')),
partition p201505 VALUES LESS THAN(UNIX_TIMESTAMP('2015-06-01 00:00:00')),
partition p201506 VALUES LESS THAN(UNIX_TIMESTAMP('2015-07-01 00:00:00')),
partition p201507 VALUES LESS THAN(UNIX_TIMESTAMP('2015-08-01 00:00:00')),
partition p201508 VALUES LESS THAN(UNIX_TIMESTAMP('2015-09-01 00:00:00')),
partition p201509 VALUES LESS THAN(UNIX_TIMESTAMP('2015-10-01 00:00:00')),
partition p201510 VALUES LESS THAN(UNIX_TIMESTAMP('2015-11-01 00:00:00')),
partition p201511 VALUES LESS THAN(UNIX_TIMESTAMP('2015-12-01 00:00:00')),
partition p201512 VALUES LESS THAN(UNIX_TIMESTAMP('2016-01-01 00:00:00')),
partition p201601 VALUES LESS THAN(UNIX_TIMESTAMP('2016-02-01 00:00:00')),
partition p201602 VALUES LESS THAN(UNIX_TIMESTAMP('2016-03-01 00:00:00')),
partition p201603 VALUES LESS THAN(UNIX_TIMESTAMP('2016-04-01 00:00:00')),
partition p201604 VALUES LESS THAN(UNIX_TIMESTAMP('2016-05-01 00:00:00')),
partition p201605 VALUES LESS THAN(UNIX_TIMESTAMP('2016-06-01 00:00:00')),
partition p201606 VALUES LESS THAN(UNIX_TIMESTAMP('2016-07-01 00:00:00')),
partition p201607 VALUES LESS THAN(UNIX_TIMESTAMP('2016-08-01 00:00:00')),
partition p201608 VALUES LESS THAN(UNIX_TIMESTAMP('2016-09-01 00:00:00')),
partition p201609 VALUES LESS THAN(UNIX_TIMESTAMP('2016-10-01 00:00:00')),
partition p201610 VALUES LESS THAN(UNIX_TIMESTAMP('2016-11-01 00:00:00')),
partition p201611 VALUES LESS THAN(UNIX_TIMESTAMP('2016-12-01 00:00:00')),
partition p201612 VALUES LESS THAN(UNIX_TIMESTAMP('2017-01-01 00:00:00')),
partition pmax VALUES LESS THAN MAXVALUE
);
CREATE TABLE `history_uint` (
`itemid` bigint(20) unsigned NOT NULL,
`clock` int(11) NOT NULL DEFAULT '0',
`value` bigint(20) unsigned NOT NULL DEFAULT '0',
`ns` int(11) NOT NULL DEFAULT '0',
primary KEY `history_uint_1` (`itemid`,`clock`),
KEY `history_uint_2` (`clock`,`itemid`)
) ENGINE=tokudb DEFAULT CHARSET=utf8
partition by range(clock)
(
partition p201501 VALUES LESS THAN(UNIX_TIMESTAMP('2015-02-01 00:00:00')),
partition p201502 VALUES LESS THAN(UNIX_TIMESTAMP('2015-03-01 00:00:00')),
partition p201503 VALUES LESS THAN(UNIX_TIMESTAMP('2015-04-01 00:00:00')),
partition p201504 VALUES LESS THAN(UNIX_TIMESTAMP('2015-05-01 00:00:00')),
partition p201505 VALUES LESS THAN(UNIX_TIMESTAMP('2015-06-01 00:00:00')),
partition p201506 VALUES LESS THAN(UNIX_TIMESTAMP('2015-07-01 00:00:00')),
partition p201507 VALUES LESS THAN(UNIX_TIMESTAMP('2015-08-01 00:00:00')),
partition p201508 VALUES LESS THAN(UNIX_TIMESTAMP('2015-09-01 00:00:00')),
partition p201509 VALUES LESS THAN(UNIX_TIMESTAMP('2015-10-01 00:00:00')),
partition p201510 VALUES LESS THAN(UNIX_TIMESTAMP('2015-11-01 00:00:00')),
partition p201511 VALUES LESS THAN(UNIX_TIMESTAMP('2015-12-01 00:00:00')),
partition p201512 VALUES LESS THAN(UNIX_TIMESTAMP('2016-01-01 00:00:00')),
partition p201601 VALUES LESS THAN(UNIX_TIMESTAMP('2016-02-01 00:00:00')),
partition p201602 VALUES LESS THAN(UNIX_TIMESTAMP('2016-03-01 00:00:00')),
partition p201603 VALUES LESS THAN(UNIX_TIMESTAMP('2016-04-01 00:00:00')),
partition p201604 VALUES LESS THAN(UNIX_TIMESTAMP('2016-05-01 00:00:00')),
partition p201605 VALUES LESS THAN(UNIX_TIMESTAMP('2016-06-01 00:00:00')),
partition p201606 VALUES LESS THAN(UNIX_TIMESTAMP('2016-07-01 00:00:00')),
partition p201607 VALUES LESS THAN(UNIX_TIMESTAMP('2016-08-01 00:00:00')),
partition p201608 VALUES LESS THAN(UNIX_TIMESTAMP('2016-09-01 00:00:00')),
partition p201609 VALUES LESS THAN(UNIX_TIMESTAMP('2016-10-01 00:00:00')),
partition p201610 VALUES LESS THAN(UNIX_TIMESTAMP('2016-11-01 00:00:00')),
partition p201611 VALUES LESS THAN(UNIX_TIMESTAMP('2016-12-01 00:00:00')),
partition p201612 VALUES LESS THAN(UNIX_TIMESTAMP('2017-01-01 00:00:00')),
partition pmax VALUES LESS THAN MAXVALUE
);
CREATE TABLE `history_text` (
`id` bigint(20) unsigned NOT NULL,
`itemid` bigint(20) unsigned NOT NULL,
`clock` int(11) NOT NULL DEFAULT '0',
`value` text NOT NULL,
`ns` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`,clock),
UNIQUE KEY `history_text_2` (`itemid`,`id`,clock),
KEY `history_text_1` (`itemid`,`clock`),
KEY `history_text_3` (`clock`,`itemid`)
) ENGINE=tokudb DEFAULT CHARSET=utf8
partition by range(clock)
(
partition p201501 VALUES LESS THAN(UNIX_TIMESTAMP('2015-02-01 00:00:00')),
partition p201502 VALUES LESS THAN(UNIX_TIMESTAMP('2015-03-01 00:00:00')),
partition p201503 VALUES LESS THAN(UNIX_TIMESTAMP('2015-04-01 00:00:00')),
partition p201504 VALUES LESS THAN(UNIX_TIMESTAMP('2015-05-01 00:00:00')),
partition p201505 VALUES LESS THAN(UNIX_TIMESTAMP('2015-06-01 00:00:00')),
partition p201506 VALUES LESS THAN(UNIX_TIMESTAMP('2015-07-01 00:00:00')),
partition p201507 VALUES LESS THAN(UNIX_TIMESTAMP('2015-08-01 00:00:00')),
partition p201508 VALUES LESS THAN(UNIX_TIMESTAMP('2015-09-01 00:00:00')),
partition p201509 VALUES LESS THAN(UNIX_TIMESTAMP('2015-10-01 00:00:00')),
partition p201510 VALUES LESS THAN(UNIX_TIMESTAMP('2015-11-01 00:00:00')),
partition p201511 VALUES LESS THAN(UNIX_TIMESTAMP('2015-12-01 00:00:00')),
partition p201512 VALUES LESS THAN(UNIX_TIMESTAMP('2016-01-01 00:00:00')),
partition p201601 VALUES LESS THAN(UNIX_TIMESTAMP('2016-02-01 00:00:00')),
partition p201602 VALUES LESS THAN(UNIX_TIMESTAMP('2016-03-01 00:00:00')),
partition p201603 VALUES LESS THAN(UNIX_TIMESTAMP('2016-04-01 00:00:00')),
partition p201604 VALUES LESS THAN(UNIX_TIMESTAMP('2016-05-01 00:00:00')),
partition p201605 VALUES LESS THAN(UNIX_TIMESTAMP('2016-06-01 00:00:00')),
partition p201606 VALUES LESS THAN(UNIX_TIMESTAMP('2016-07-01 00:00:00')),
partition p201607 VALUES LESS THAN(UNIX_TIMESTAMP('2016-08-01 00:00:00')),
partition p201608 VALUES LESS THAN(UNIX_TIMESTAMP('2016-09-01 00:00:00')),
partition p201609 VALUES LESS THAN(UNIX_TIMESTAMP('2016-10-01 00:00:00')),
partition p201610 VALUES LESS THAN(UNIX_TIMESTAMP('2016-11-01 00:00:00')),
partition p201611 VALUES LESS THAN(UNIX_TIMESTAMP('2016-12-01 00:00:00')),
partition p201612 VALUES LESS THAN(UNIX_TIMESTAMP('2017-01-01 00:00:00')),
partition pmax VALUES LESS THAN MAXVALUE
);
CREATE TABLE `trends` (
`itemid` bigint(20) unsigned NOT NULL,
`clock` int(11) NOT NULL DEFAULT '0',
`num` int(11) NOT NULL DEFAULT '0',
`value_min` double(16,4) NOT NULL DEFAULT '0.0000',
`value_avg` double(16,4) NOT NULL DEFAULT '0.0000',
`value_max` double(16,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`itemid`,`clock`)
) ENGINE=tokudb DEFAULT CHARSET=utf8
partition by range(clock)
(
partition p201501 VALUES LESS THAN(UNIX_TIMESTAMP('2015-02-01 00:00:00')),
partition p201502 VALUES LESS THAN(UNIX_TIMESTAMP('2015-03-01 00:00:00')),
partition p201503 VALUES LESS THAN(UNIX_TIMESTAMP('2015-04-01 00:00:00')),
partition p201504 VALUES LESS THAN(UNIX_TIMESTAMP('2015-05-01 00:00:00')),
partition p201505 VALUES LESS THAN(UNIX_TIMESTAMP('2015-06-01 00:00:00')),
partition p201506 VALUES LESS THAN(UNIX_TIMESTAMP('2015-07-01 00:00:00')),
partition p201507 VALUES LESS THAN(UNIX_TIMESTAMP('2015-08-01 00:00:00')),
partition p201508 VALUES LESS THAN(UNIX_TIMESTAMP('2015-09-01 00:00:00')),
partition p201509 VALUES LESS THAN(UNIX_TIMESTAMP('2015-10-01 00:00:00')),
partition p201510 VALUES LESS THAN(UNIX_TIMESTAMP('2015-11-01 00:00:00')),
partition p201511 VALUES LESS THAN(UNIX_TIMESTAMP('2015-12-01 00:00:00')),
partition p201512 VALUES LESS THAN(UNIX_TIMESTAMP('2016-01-01 00:00:00')),
partition p201601 VALUES LESS THAN(UNIX_TIMESTAMP('2016-02-01 00:00:00')),
partition p201602 VALUES LESS THAN(UNIX_TIMESTAMP('2016-03-01 00:00:00')),
partition p201603 VALUES LESS THAN(UNIX_TIMESTAMP('2016-04-01 00:00:00')),
partition p201604 VALUES LESS THAN(UNIX_TIMESTAMP('2016-05-01 00:00:00')),
partition p201605 VALUES LESS THAN(UNIX_TIMESTAMP('2016-06-01 00:00:00')),
partition p201606 VALUES LESS THAN(UNIX_TIMESTAMP('2016-07-01 00:00:00')),
partition p201607 VALUES LESS THAN(UNIX_TIMESTAMP('2016-08-01 00:00:00')),
partition p201608 VALUES LESS THAN(UNIX_TIMESTAMP('2016-09-01 00:00:00')),
partition p201609 VALUES LESS THAN(UNIX_TIMESTAMP('2016-10-01 00:00:00')),
partition p201610 VALUES LESS THAN(UNIX_TIMESTAMP('2016-11-01 00:00:00')),
partition p201611 VALUES LESS THAN(UNIX_TIMESTAMP('2016-12-01 00:00:00')),
partition p201612 VALUES LESS THAN(UNIX_TIMESTAMP('2017-01-01 00:00:00')),
partition pmax VALUES LESS THAN MAXVALUE
);
CREATE TABLE `trends_uint` (
`itemid` bigint(20) unsigned NOT NULL,
`clock` int(11) NOT NULL DEFAULT '0',
`num` int(11) NOT NULL DEFAULT '0',
`value_min` bigint(20) unsigned NOT NULL DEFAULT '0',
`value_avg` bigint(20) unsigned NOT NULL DEFAULT '0',
`value_max` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`itemid`,`clock`)
) ENGINE=tokudb DEFAULT CHARSET=utf8
partition by range(clock)
(
partition p201501 VALUES LESS THAN(UNIX_TIMESTAMP('2015-02-01 00:00:00')),
partition p201502 VALUES LESS THAN(UNIX_TIMESTAMP('2015-03-01 00:00:00')),
partition p201503 VALUES LESS THAN(UNIX_TIMESTAMP('2015-04-01 00:00:00')),
partition p201504 VALUES LESS THAN(UNIX_TIMESTAMP('2015-05-01 00:00:00')),
partition p201505 VALUES LESS THAN(UNIX_TIMESTAMP('2015-06-01 00:00:00')),
partition p201506 VALUES LESS THAN(UNIX_TIMESTAMP('2015-07-01 00:00:00')),
partition p201507 VALUES LESS THAN(UNIX_TIMESTAMP('2015-08-01 00:00:00')),
partition p201508 VALUES LESS THAN(UNIX_TIMESTAMP('2015-09-01 00:00:00')),
partition p201509 VALUES LESS THAN(UNIX_TIMESTAMP('2015-10-01 00:00:00')),
partition p201510 VALUES LESS THAN(UNIX_TIMESTAMP('2015-11-01 00:00:00')),
partition p201511 VALUES LESS THAN(UNIX_TIMESTAMP('2015-12-01 00:00:00')),
partition p201512 VALUES LESS THAN(UNIX_TIMESTAMP('2016-01-01 00:00:00')),
partition p201601 VALUES LESS THAN(UNIX_TIMESTAMP('2016-02-01 00:00:00')),
partition p201602 VALUES LESS THAN(UNIX_TIMESTAMP('2016-03-01 00:00:00')),
partition p201603 VALUES LESS THAN(UNIX_TIMESTAMP('2016-04-01 00:00:00')),
partition p201604 VALUES LESS THAN(UNIX_TIMESTAMP('2016-05-01 00:00:00')),
partition p201605 VALUES LESS THAN(UNIX_TIMESTAMP('2016-06-01 00:00:00')),
partition p201606 VALUES LESS THAN(UNIX_TIMESTAMP('2016-07-01 00:00:00')),
partition p201607 VALUES LESS THAN(UNIX_TIMESTAMP('2016-08-01 00:00:00')),
partition p201608 VALUES LESS THAN(UNIX_TIMESTAMP('2016-09-01 00:00:00')),
partition p201609 VALUES LESS THAN(UNIX_TIMESTAMP('2016-10-01 00:00:00')),
partition p201610 VALUES LESS THAN(UNIX_TIMESTAMP('2016-11-01 00:00:00')),
partition p201611 VALUES LESS THAN(UNIX_TIMESTAMP('2016-12-01 00:00:00')),
partition p201612 VALUES LESS THAN(UNIX_TIMESTAMP('2017-01-01 00:00:00')),
partition pmax VALUES LESS THAN MAXVALUE
)