Skip to content

Commit

Permalink
cleanup: copy_data_between_tables()
Browse files Browse the repository at this point in the history
don't read all columns from the source table, but only
those that the will be inserted into the target table
and cannot be generated by the target table.

test case is in the following commits
  • Loading branch information
vuvova committed Jun 4, 2018
1 parent a0db3d7 commit ac9cc63
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sql/sql_table.cc
Expand Up @@ -10202,10 +10202,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,

alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);

/* Set read map for all fields in from table */
from->default_column_bitmaps();
bitmap_set_all(from->read_set);
from->file->column_bitmaps_signal();

/* We can abort alter table for any table type */
thd->abort_on_warning= !ignore && thd->is_strict_mode();
Expand Down Expand Up @@ -10235,7 +10232,11 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
if (def->field == from->found_next_number_field)
thd->variables.sql_mode|= MODE_NO_AUTO_VALUE_ON_ZERO;
}
(copy_end++)->set(*ptr,def->field,0);
if (!(*ptr)->vcol_info)
{
bitmap_set_bit(from->read_set, def->field->field_index);
(copy_end++)->set(*ptr,def->field,0);
}
}
else
{
Expand Down Expand Up @@ -10304,6 +10305,11 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
from_row_end= from->vers_end_field();
}

if (from_row_end)
bitmap_set_bit(from->read_set, from_row_end->field_index);

from->file->column_bitmaps_signal();

THD_STAGE_INFO(thd, stage_copy_to_tmp_table);
/* Tell handler that we have values for all columns in the to table */
to->use_all_columns();
Expand Down

0 comments on commit ac9cc63

Please sign in to comment.