#At file:///Users/tnurnberg/forest/11749160x/50-11749160x/ based on revid:karen.langford@stripped
2913 Tatjana Azundris Nuernberg 2011-06-16
Bug#11749160/Bug#38318: is call thd->end_time() in log_slow_statement needed if slow logs are disabled ?
Optimization to save some function calls when slow logging is disabled.
@ sql/sql_parse.cc
Optimization to save some function calls when slow logging is disabled:
work out execution time only when we need to.
modified:
sql/sql_parse.cc
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-01-26 07:30:06 +0000
+++ b/sql/sql_parse.cc 2011-06-16 06:52:11 +0000
@@ -2410,8 +2410,6 @@ bool dispatch_command(enum enum_server_c
void log_slow_statement(THD *thd)
{
- time_t start_of_query;
-
/*
The following should never be true with our current code base,
but better to keep this here so we don't accidently try to log a
@@ -2420,17 +2418,19 @@ void log_slow_statement(THD *thd)
if (unlikely(thd->in_sub_stmt))
return; // Don't set time for sub stmt
- start_of_query= thd->start_time;
- thd->end_time(); // Set start time
-
/*
Do not log administrative statements unless the appropriate option is
set; do not log into slow log if reading from backup.
*/
if (thd->enable_slow_log && !thd->user_time)
{
+ time_t start_of_query;
+
thd_proc_info(thd, "logging slow query");
+ start_of_query= thd->start_time;
+ thd->end_time(); // Set start time
+
if ((thd->start_time > thd->time_after_lock &&
(ulong) (thd->start_time - thd->time_after_lock) >
thd->variables.long_query_time) ||
Attachment: [text/bzr-bundle] bzr/tatjana.nuernberg@oracle.com-20110616065211-p796uknyukjh9ivm.bundle
| Thread |
|---|
| • bzr commit into mysql-5.0 branch (tatjana.nuernberg:2913) Bug#38318Bug#11749160 | Tatjana Azundris Nuernberg | 16 Jun |