Bug #69118 Wasted work in method get_table_structure()
Submitted: 2 May 2013 2:28 Modified: 2 May 2013 14:00
Reporter: Po-Chun Chang (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Command-line Clients Severity:S5 (Performance)
Version:5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: patch, performance

[2 May 2013 2:28] Po-Chun Chang
The problem appears in version 5.6 and in the latest revision 5216 in
version 5.7.  I attached a one-line patch that fixes it.

In method "get_table_structure" in mysqldump.c, the loop on
"mysql_fetch_row(result)" (line 2855) should not be executed when
"complete_insert" is "false".  When "complete_insert" is "false", all
the iterations do not perform any useful work.

How to repeat:
Once this loop is executed.

Suggested fix:
=== modified file 'client/mysqldump.c'
--- client/mysqldump.c	2013-02-26 05:45:28 +0000
+++ client/mysqldump.c	2013-05-02 02:26:15 +0000
@@ -2774,9 +2774,9 @@
-    while ((row= mysql_fetch_row(result)))
+    if (complete_insert)
-      if (complete_insert)
+      while ((row= mysql_fetch_row(result)))
         if (init)
[2 May 2013 2:28] Po-Chun Chang
Suggested patch

Attachment: patch.diff (text/plain), 368 bytes.

[2 May 2013 4:15] MySQL Verification Team
thanks for the report. i wonder, is it even possible to remove the entire 'show fields from' query altogether!
[2 May 2013 4:18] MySQL Verification Team
Po-Chun, please note the following if you are submitting patches:

In order to submit contributions you must first sign the Oracle Contribution Agreement (OCA).
For additional information please check http://www.oracle.com/technetwork/community/oca-486395.html.
If you have any questions, please contact the MySQL community team.
[2 May 2013 14:00] Po-Chun Chang
Thanks Shane, I have remitted the OCA.