summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-06-02 16:33:27 +0200
committerSergei Golubchik <serg@mariadb.org>2018-06-04 12:32:23 +0200
commitac9cc638923836cb7f0d44d1919ad2d5afc2a9f4 (patch)
tree72514ea73ee8b245e821a1a6268f9eab7d095841
parenta0db3d714fa31255123574a76663ce0d53c262c9 (diff)
downloadmariadb-git-ac9cc638923836cb7f0d44d1919ad2d5afc2a9f4.tar.gz
cleanup: copy_data_between_tables()
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
-rw-r--r--sql/sql_table.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6835d92773c..db1fafb400c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -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();
@@ -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
{
@@ -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();