MySQL Query Browser --执行SQL语句的两个时间区别

X row(s) fetched in Y s (Z s)

X = number of rows (of course)
Y =  time the resultset spent in transit from the server to the client
Z =  time it took the MySQL server to execute the query (parse, retrieve, send)

下面是相关代码(Windows UI)

FResultset.SetStatusCaption(Format(_('Query aborted. %d rows fetched so far in %.4fs (%.4fs)'), [FCurrentRowCount,
FResultset.ResultSet.fetch_time, FResultset.ResultSet.query_time]))

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.

猜你喜欢

转载自sweat89.iteye.com/blog/1704941