2010年5月12日星期三

MySQL Query Browser的SQL语句耗时提示

在MySQL Query Browser中执行一条SQL语句,会发现左下角有一行提示:

N row(s) fetched in Time1 s(Time2 s)


以前没有在意里面两个时间的区别,最近数据库(IBM x3650)网卡故障,访问很慢,在排除软件问题的时候,发现这两个时间比较诡异,有时Time1比Time2大很多。google了下,这里可以看到sun数据库工程师的解释:

 query_time is the time the query needed to execute:

// Start query timer
timer_start(&timer);

if (sql)
r= myx_mysql_query(mysql, resultset->query->sql);
#if MYSQL_VERSION_ID >= 50000
else
r= mysql_next_result(mysql);
#endif
// Stop query timer
resultset->query_time= timer_stop(&timer);

and fetch_time is what it took to get the result set transferred to the client.


可以得知,Time1是服务器端把结果传回客户端的时间,Time2是数据库执行SQL语句的时间。

没有评论: