表结构: CREATE TABLE `instance` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `timestamp` int(10) unsigned DEFAULT NULL, `cpu` decimal(8,3) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; 统计每半小时平均值,实现可以如下: select `timestamp`-`timestamp`% (5*60) , avg(cup) from `instance` group by `timestamp`