Bug #37390 "mysqldump -d" can not implement "show table status"
Submitted: 13 Jun 2008 9:53 Modified: 30 Sep 2009 8:54
Reporter: talen xu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S5 (Performance)
Version:5.0++ OS:Any
Assigned to: CPU Architecture:Any

[13 Jun 2008 9:53] talen xu
Description:
mysqldump -d,MySQL4 to MySQL5 slower than many

because MySQL5 than in the call in a function get_table_structure function check_if_ignore_table , and not MySQL4.
Check_if_ignore_table function of the need to implement "show table status" to determine the type of INSERT DELAYED Table.
However, the implementation of InnoDB engine efficiency poor show table status

How to repeat:
Can not function Check_if_ignore_table in the judgement  INSERT DELAYED?
In other words can replace the show table status as a basis for judgement
[13 Jun 2008 11:09] Susanne Ebrecht
Many thanks for writing a bug report.

What exactly do you mean here?

If I understand you right then this is a duplicate of bug #33057.

Please let us know, if I understand you right.
[13 Jun 2008 16:15] talen xu
MySQL 5.0++  mysqldump.c
char check_if_ignore_table(const char *table_name, char *table_type)
{
  char result= IGNORE_NONE;
  char buff[FN_REFLEN+80], show_name_buff[FN_REFLEN];
  MYSQL_RES *res= NULL;
  MYSQL_ROW row;
  DBUG_ENTER("check_if_ignore_table");
  /* 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", ///here///
              quote_for_like(table_name, show_name_buff));
  if (mysql_query_with_error_report(mysql, &res, buff))
  {
    if (mysql_errno(mysql) != ER_PARSE_ERROR)
    {                                   /* If old MySQL version */
      verbose_msg("-- Warning: Couldn't get status information for "
                  "table %s (%s)\n", table_name, mysql_error(mysql));
      DBUG_RETURN(result);                       /* assume table is ok */
    }
  }

----------------------------------------------------------------------------------
MySQL 5.0++

static uint get_table_structure(char *table, char *db, char *table_type,
                                char *ignore_flag)
{
  my_bool    init=0, delayed, write_data, complete_insert;
  my_ulonglong num_fields;
  char       *result_table, *opt_quoted_table;
  const char *insert_option;
  char       name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
  char       table_buff2[NAME_LEN*2+3], query_buff[512];
  FILE       *sql_file= md_result_file;
  int        len;
  MYSQL_RES  *result;
  MYSQL_ROW  row;
  DBUG_ENTER("get_table_structure");
  DBUG_PRINT("enter", ("db: %s  table: %s", db, table));
*ignore_flag= check_if_ignore_table(table, table_type);  ///here///

MySQL 4.1.22
static uint getTableStructure(char *table, char* db)
{
  MYSQL_RES  *tableRes;
  MYSQL_ROW  row;
  my_bool    init=0;
  uint       numFields;
  char       *result_table, *opt_quoted_table;
  const char *insert_option;
  char       name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
  char       table_buff2[NAME_LEN*2+3];
  char       query_buff[512];
  FILE       *sql_file = md_result_file;
  int        len;
  DBUG_ENTER("getTableStructure");
  DBUG_PRINT("enter", ("db: %s, table: %s", db, table));
  if (!insert_pat_inited)
  {
    insert_pat_inited= init_dynamic_string(&insert_pat, "", 1024, 1024);
  }
  else
    dynstr_set(&insert_pat, "");
  insert_option= ((opt_delayed && opt_ignore) ? " DELAYED IGNORE " :
                  opt_delayed ? " DELAYED " :
                  opt_ignore ? " IGNORE " : "");

"mysqldump -d" can not implement "show table status"?For InnoDB engine, it has been too slow
[30 Sep 2009 8:54] Sveta Smirnova
Thank you for the feedback.

Yes, this is possible to replace SHOW TABLE STATUS with SHOW TABLES + SHOW CREATE TABLE + parsing of result or select engine from information_schema.tables where TABLE_NAME='TABLE_NAME' and TABLE_SCHEMA ='DBNAME';