赞
踩
现在有一个百万条的数据库库测试:
SELECT sum(length(dest_mobile) +1 - length(replace(dest_mobile,';',''))) as channel_num
from mt_sms_200804
where date_time3 BETWEEN '2008-04-15 09:00:00' and '2008-04-15 10:00:00'
SELECT sum(length(dest_mobile) +1 - length(replace(dest_mobile,';',''))) as channel_num
from mt_sms_200804
where date_time3 like '2008-04-15 09%'
SELECT sum(length(dest_mobile) +1 - length(replace(dest_mobile,';',''))) as channel_num
from mt_sms_200804
where left(date_time3,13) = '2008-04-15 09'
每个小时的执行时间(10,11,12,13,14,15,16) :
BETWEEN AND : 2.047 sec 2.344 sec 3.562 sec 3.063 sec 2.266 sec 3.031 sec 2.562 sec
LIKE : 2.375 sec 2.531 sec 2.969 sec 3.375 sec 2.109 sec 2.250 sec 2.375 sec
LEFT() : 1.906 sec 1.938 sec 2.563 sec 3.813 sec 2.218 sec 2.750 sec 2.594 sec
(一天的数据查询时间比对)
BETWEEN AND : 5.610 sec
LIKE : 7.328
LEFT() : 5.640
这种方法也只能测试第一次测试的结果,第二次,结果就可能被缓存。
所以大家可以讨论一下,关于测试这三中查询方式,那个最有效率?在条件一致的情况下。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。