我很抱歉。 我确信,我需要做的是增加正确的指数,但我所尝试的所有事情都没有工作。
问题是:
SELECT DATE(DateTime) as SpeedDate , avg(LoadTime) as LoadTime
FROM SpeedMonitor
GROUP BY Date(DateTime);
The Explain for the query is:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE SpeedMonitor ALL 7259978 Using temporary; Using filesort
表结构是:
CREATE TABLE `SpeedMonitor` (
`SMID` int(10) unsigned NOT NULL auto_increment,
`DateTime` datetime NOT NULL,
`LoadTime` double unsigned NOT NULL,
PRIMARY KEY (`SMID`)
) ENGINE=InnoDB AUTO_INCREMENT=7258294 DEFAULT CHARSET=latin1;
任何帮助都将受到高度赞赏。