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
我在示例查询中使用 EXPLAIN 得到下一个结果:
EXPLAIN PARTITIONS SELECT * FROM temp where PartitionID = 1
或者
EXPLAIN PARTITIONS SELECT * FROM temp where PartitionID = DAYOFYEAR('2013-01-01 10:24:00')
结果:
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE temp p1 ALL 2 Using where
我不知道为什么它使用 p1 分区。这里 parititon 以 p0 开头