DROP TABLE temp;
CREATE TABLE `temp` (
`CallID` bigint(8) unsigned NOT NULL,
`InfoID` bigint(8) unsigned NOT NULL,
`CallStartTime` datetime NOT NULL,
`PartitionID` int(4) unsigned NOT NULL,
KEY `CallStartTime`(`CallStartTime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY HASH (PartitionID)
PARTITIONS 366
I am using EXPLAIN in the sample request. I get the following result:
EXPLAIN PARTITIONS SELECT * FROM temp where PartitionID = 1
or
EXPLAIN PARTITIONS SELECT * FROM temp where PartitionID = DAYOFYEAR('2013-01-01 10:24:00')
result:
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE temp p1 ALL 2 Using where
I do not know why it uses the p1 partition. Here the paratiton begins with p0
source
share