[Commits] 53b73a7: MDEV-6714 mysqldump slow with tables in big databases

vicentiu at mariadb.org vicentiu at mariadb.org
Mon Mar 16 22:00:40 EET 2015


revision-id: 53b73a7940039809a02184a69502142d767b0741
parent(s): 197afb413fcc9f06b5e5e6ef41ce980d108b354f
committer: Vicențiu Ciorbaru
branch nick: server
timestamp: 2015-03-16 21:59:26 +0200
message:

MDEV-6714 mysqldump slow with tables in big databases

First draft commit. Performance speedup achieved.

---
 client/mysqldump.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/client/mysqldump.c b/client/mysqldump.c
index 2da4ce6..6138e94 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -3341,7 +3341,8 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
   /* Get list of triggers. */
 
   my_snprintf(query_buff, sizeof(query_buff),
-              "SHOW TRIGGERS LIKE %s",
+              "SELECT TRIGGER_NAME from INFORMATION_SCHEMA.TRIGGERS "
+              "where TRIGGER_SCHEMA = DATABASE() and EVENT_OBJECT_TABLE = %s",
               quote_for_like(table_name, name_buff));
 
   if (mysql_query_with_error_report(mysql, &show_triggers_rs, query_buff))
@@ -4716,8 +4717,12 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root)
 
   /* Check memory for quote_for_like() */
   DBUG_ASSERT(2*sizeof(old_table_name) < sizeof(show_name_buff));
-  my_snprintf(query, sizeof(query), "SHOW TABLES LIKE %s",
+  my_snprintf(query, sizeof(query),
+      "select table_name from information_schema.tables "
+      "where table_schema = DATABASE() "
+      "and table_name = %s",
               quote_for_like(old_table_name, show_name_buff));
+  verbose_msg(query);
 
   if (mysql_query_with_error_report(mysql, 0, query))
     return NullS;
@@ -5369,7 +5374,7 @@ char check_if_ignore_table(const char *table_name, char *table_type)
 
   /* Check memory for quote_for_like() */
   DBUG_ASSERT(2*sizeof(table_name) < sizeof(show_name_buff));
-  my_snprintf(buff, sizeof(buff), "show table status like %s",
+  my_snprintf(buff, sizeof(buff), "select table_type from INFORMATION_SCHEMA.tables where table_name = %s",
               quote_for_like(table_name, show_name_buff));
   if (mysql_query_with_error_report(mysql, &res, buff))
   {
@@ -5388,7 +5393,7 @@ char check_if_ignore_table(const char *table_name, char *table_type)
     mysql_free_result(res);
     DBUG_RETURN(result);                         /* assume table is ok */
   }
-  if (!(row[1]))
+  if (!(row[0]))
     strmake(table_type, "VIEW", NAME_LEN-1);
   else
   {
@@ -5398,7 +5403,7 @@ char check_if_ignore_table(const char *table_name, char *table_type)
       these types, but we do want to use delayed inserts in the dump if
       the table type is _NOT_ one of these types
     */
-    strmake(table_type, row[1], NAME_LEN-1);
+    strmake(table_type, row[0], NAME_LEN-1);
     if (opt_delayed)
     {
       if (strcmp(table_type,"MyISAM") &&


More information about the commits mailing list