mysql> show create table history\G;
*************************** 1. row ***************************
Table: history
Create Table: 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',
KEY `history_1` (`itemid`,`clock`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (clock)
(PARTITION p20150806 VALUES LESS THAN (1438876800) ENGINE = InnoDB,
PARTITION p20150807 VALUES LESS THAN (1438963200) ENGINE = InnoDB,
PARTITION p20150808 VALUES LESS THAN (1439049600) ENGINE = InnoDB,
PARTITION p20150809 VALUES LESS THAN (1439136000) ENGINE = InnoDB,
PARTITION p20150810 VALUES LESS THAN (1439222400) ENGINE = InnoDB,
PARTITION p20150811 VALUES LESS THAN (1439308800) ENGINE = InnoDB,
PARTITION p20150812 VALUES LESS THAN (1439395200) ENGINE = InnoDB,
PARTITION p20150813 VALUES LESS THAN (1439481600) ENGINE = InnoDB,
[root@master ~]# date -d@1438857116 "+%Y-%m-%d"
2015-08-06
[root@master ~]# date -d@1438909741 "+%Y-%m-%d"
2015-08-07
mysql> select min(clock),max(clock) from history;
+------------+------------+
| min(clock) | max(clock) |
+------------+------------+
| 1438857116 | 1438909857 |
+------------+------------+
1 row in set (0.01 sec)
mysql> select min(clock),max(clock) from history partition(p20150806);
+------------+------------+
| min(clock) | max(clock) |
+------------+------------+
| 1438857116 | 1438876797 |
+------------+------------+
1 row in set (0.00 sec)
[root@master ~]# date -d@1438857116 "+%Y-%m-%d"
2015-08-06
[root@master ~]# date -d@1438876797 "+%Y-%m-%d"
2015-08-06
mysql> select min(clock),max(clock) from history partition(p20150807);
+------------+------------+
| min(clock) | max(clock) |
+------------+------------+
| 1438876800 | 1438909861 |
+------------+------------+
1 row in set (0.00 sec)
[root@master ~]# date -d@1438876799 "+%Y-%m-%d"
2015-08-06
[root@master ~]# date -d@1438876800 "+%Y-%m-%d"
2015-08-07
[root@master ~]# date -d@1438909861 "+%Y-%m-%d"
2015-08-07