我有一张桌子:
CREATE TABLE `ais`.`last_location` (
`timestamp` timestamp NOT NULL default '0000-00-00 00:00:00',
`message_type` tinyint(4) NOT NULL default '0',
`repeat_indicator` tinyint(4) NOT NULL default '0',
`mmsi` int(11) NOT NULL default '0',
`navigation_status` tinyint(4) NOT NULL default '0',
`rot` tinyint(4) NOT NULL default '0',
`sog` smallint(6) NOT NULL default '0',
`position_accuracy` tinyint(4) NOT NULL default '0',
`longitude` int(11) NOT NULL default '0',
`latitude` int(11) NOT NULL default '0',
`cog` smallint(6) NOT NULL default '0',
`hdg` smallint(6) NOT NULL default '0',
`time_stamp` tinyint(4) NOT NULL default '0',
`maneuver_indicator` tinyint(4) NOT NULL default '0',
`spare` tinyint(4) NOT NULL default '0',
`raim_flag` tinyint(4) NOT NULL default '0',
`sotdma_sync_state` tinyint(4) NOT NULL default '0',
`sotdma_slot_timeout` tinyint(4) NOT NULL default '0',
`sotdma_slot_offset` smallint(6) NOT NULL default '0',
PRIMARY KEY USING BTREE (`mmsi`),
KEY `Index_2` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"
我向查询解释:
EXPLAIN SELECT *
FROM last_location
WHERE `timestamp` BETWEEN '2013-01-01 12:00:00' AND '2013-06-03 11:30:00'
1, 'SIMPLE', 'last_location', 'range', 'Index_2', 'Index_2', '4', '', 83, 'Using where'
EXPLAIN SELECT *
FROM last_location
WHERE `timestamp` BETWEEN '2013-01-01 12:00:00' AND '2013-06-03 11:40:00'
1, 'SIMPLE', 'last_location', 'ALL', 'Index_2', '', '', '', 478, 'Using where'
谁能告诉我搜索到 11:30 和 11:40 之间的区别?使用 11:30 时,我认为一切正常吗?但是当使用 11:40 时它不再使用索引了吗?