From: Tatjana Azundris Nuernberg Date: June 16 2011 6:52am Subject: bzr commit into mysql-5.0 branch (tatjana.nuernberg:2913) Bug#38318 Bug#11749160 List-Archive: http://lists.mysql.com/commits/139283 X-Bug: 38318,11749160 Message-Id: <201106160652.p5G6qaWr019146@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7783611353468221721==" --===============7783611353468221721== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #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) || --===============7783611353468221721== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/tatjana.nuernberg@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: tatjana.nuernberg@stripped\ # p796uknyukjh9ivm # target_branch: file:///Users/tnurnberg/forest/11749160x/50-\ # 11749160x/ # testament_sha1: a7919d74305abd4427b57a692568b5ba2578ae74 # timestamp: 2011-06-16 07:52:31 +0100 # base_revision_id: karen.langford@stripped\ # 9keuxoidua7vo7jq # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWamI2sYAAddfgEAwWGP///IB jAC////wUASN7NyhMU6Rs2WhJISYTFPRiaBkifpNPRNEeoNAeoMoRhGCnoU9TYoxAAAANAYiBNAI 0mofqjaZR6mjJp6gyaAGAAAAAAAAAAASSpjQyBCZPIJkZNGmmjQ00DI2UE5XD92rdIN9ex01XNNd cPr2Z1FO5LMNCDbHxb9KBzPTu1SRH26DzhJ6vmrlFDKSZ0wx6bfDz4oYDVhi3xzvExb1wJ/5Y5Xs /8jWclOLiUkPrdE5VNYWXR5brdOSCcyLDwML+RJMpBGjxzKhdFprn+KhVx6lTdFGARSrBK7D0tmr rkpz5gPFqPk631WLp1mUYhkPjcrnET0EAXHsk8+Nk3MixjCjvorRWDCio4L8KF+VC5cgfFBbuXIF gIt7O25rqw0zDg7nRDOza0TvtWfL6ilrQUWnc8PR4SM8eq8ue0SYJZ0GKirJiEX2gipoAqI5HCZA nAa7m9oxjXKJFmYUawgEIKZi09gcaSzeHaW0jUNSWy1m5RbCK0noFgNaDHKfCzO5ZUMoBn2N732L SFhsgqwUB2je3LA0OTHXiZurrhGpaQWbqKWWJKAkGb4qBZg8qD11pQHbBSozBDBxYTEeOuGeuAWG WUFWwGC1Nmgo1IN+lEzNxhNErSNE0EsE4jFkkTzmygGYm52g0ASts/q6uIPUbL87rmVxzv2wULaK jlkEIsXaSYYxsAnGjeHPb8xvf5QvyDfBuHf3bjXtkUS11hSb4xlhFFBzPoadgcbUcD23wJ+sdJCU DfGEDJd9edNy5iM8BwdeSno7gRV1rK33VAiQNwznVH+glVUWLnb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