MySql 简单统计查询消耗时间脚本
by:授客 QQ:1033553122
drop procedure if exists selectTime;
delimiter;
create procedure selectTime()
begin
#变量定义
declare startTime datetime;
declare endTime datetime;
declare usedTime float;
#时间赋值与查询
select now() into startTime;
select * from dbaudit_fadeaf32208af19b_20130521,tobj_operate;
set endTime=now();
#计算耗费时间
select unix_timestamp(endTime)-unix_timestamp(startTime) into usedTime;
select usedTime;
end;
#调用
call selectTime();