Speedup:
- Don't call update_virtual_fields() if table->vfield is not set - Don't prealloc memory for in open_tables() as this is very seldom used. sql/records.cc: Don't call update_virtual_fields() if table->vfield is not set sql/sql_base.cc: Don't prealloc memory for in open_tables() as this is very seldom used. Don't call update_virtual_fields() if table->vfield is not set sql/sql_delete.cc: Don't call update_virtual_fields() if table->vfield is not set sql/sql_handler.cc: Don't call update_virtual_fields() if table->vfield is not set sql/sql_join_cache.cc: Don't call update_virtual_fields() if table->vfield is not set Move some frequent values to local variables sql/sql_table.cc: Don't call update_virtual_fields() if table->vfield is not set sql/sql_update.cc: Don't call update_virtual_fields() if table->vfield is not set sql/table.cc: Assert if update_virtual_fields is called with wrong parameters
This commit is contained in:
parent
8e825a2249
commit
c36bdf1c88
@ -401,7 +401,7 @@ int rr_sequential(READ_RECORD *info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tmp)
|
if (!tmp && info->table->vfield)
|
||||||
update_virtual_fields(info->thd, info->table);
|
update_virtual_fields(info->thd, info->table);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -4706,7 +4706,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
|||||||
temporary mem_root for new .frm parsing.
|
temporary mem_root for new .frm parsing.
|
||||||
TODO: variables for size
|
TODO: variables for size
|
||||||
*/
|
*/
|
||||||
init_sql_alloc(&new_frm_mem, 8024, 8024);
|
init_sql_alloc(&new_frm_mem, 8024, 0);
|
||||||
|
|
||||||
thd->current_tablenr= 0;
|
thd->current_tablenr= 0;
|
||||||
restart:
|
restart:
|
||||||
@ -8648,14 +8648,9 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
|
|||||||
}
|
}
|
||||||
/* Update virtual fields*/
|
/* Update virtual fields*/
|
||||||
thd->abort_on_warning= FALSE;
|
thd->abort_on_warning= FALSE;
|
||||||
if (vcol_table)
|
if (vcol_table && vcol_table->vfield &&
|
||||||
{
|
update_virtual_fields(thd, vcol_table, TRUE))
|
||||||
if (vcol_table->vfield)
|
goto err;
|
||||||
{
|
|
||||||
if (update_virtual_fields(thd, vcol_table, TRUE))
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
thd->abort_on_warning= save_abort_on_warning;
|
thd->abort_on_warning= save_abort_on_warning;
|
||||||
thd->no_errors= save_no_errors;
|
thd->no_errors= save_no_errors;
|
||||||
DBUG_RETURN(thd->is_error());
|
DBUG_RETURN(thd->is_error());
|
||||||
|
@ -332,7 +332,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||||||
while (!(error=info.read_record(&info)) && !thd->killed &&
|
while (!(error=info.read_record(&info)) && !thd->killed &&
|
||||||
! thd->is_error())
|
! thd->is_error())
|
||||||
{
|
{
|
||||||
update_virtual_fields(thd, table);
|
if (table->vfield)
|
||||||
|
update_virtual_fields(thd, table);
|
||||||
thd->examined_row_count++;
|
thd->examined_row_count++;
|
||||||
// thd->is_error() is tested to disallow delete row on error
|
// thd->is_error() is tested to disallow delete row on error
|
||||||
if (!select || select->skip_record(thd) > 0)
|
if (!select || select->skip_record(thd) > 0)
|
||||||
|
@ -827,7 +827,8 @@ retry:
|
|||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
/* Generate values for virtual fields */
|
/* Generate values for virtual fields */
|
||||||
update_virtual_fields(thd, table);
|
if (table->vfield)
|
||||||
|
update_virtual_fields(thd, table);
|
||||||
if (cond && !cond->val_int())
|
if (cond && !cond->val_int())
|
||||||
continue;
|
continue;
|
||||||
if (num_rows >= offset_limit_cnt)
|
if (num_rows >= offset_limit_cnt)
|
||||||
|
@ -3344,23 +3344,26 @@ int JOIN_TAB_SCAN::next()
|
|||||||
int skip_rc;
|
int skip_rc;
|
||||||
READ_RECORD *info= &join_tab->read_record;
|
READ_RECORD *info= &join_tab->read_record;
|
||||||
SQL_SELECT *select= join_tab->cache_select;
|
SQL_SELECT *select= join_tab->cache_select;
|
||||||
|
TABLE *table= join_tab->table;
|
||||||
|
THD *thd= join->thd;
|
||||||
|
|
||||||
if (is_first_record)
|
if (is_first_record)
|
||||||
is_first_record= FALSE;
|
is_first_record= FALSE;
|
||||||
else
|
else
|
||||||
err= info->read_record(info);
|
err= info->read_record(info);
|
||||||
if (!err)
|
if (!err && table->vfield)
|
||||||
update_virtual_fields(join->thd, join_tab->table);
|
update_virtual_fields(thd, table);
|
||||||
while (!err && select && (skip_rc= select->skip_record(join->thd)) <= 0)
|
while (!err && select && (skip_rc= select->skip_record(thd)) <= 0)
|
||||||
{
|
{
|
||||||
if (join->thd->killed || skip_rc < 0)
|
if (thd->killed || skip_rc < 0)
|
||||||
return 1;
|
return 1;
|
||||||
/*
|
/*
|
||||||
Move to the next record if the last retrieved record does not
|
Move to the next record if the last retrieved record does not
|
||||||
meet the condition pushed to the table join_tab.
|
meet the condition pushed to the table join_tab.
|
||||||
*/
|
*/
|
||||||
err= info->read_record(info);
|
err= info->read_record(info);
|
||||||
if (!err)
|
if (!err && table->vfield)
|
||||||
update_virtual_fields(join->thd, join_tab->table);
|
update_virtual_fields(thd, table);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -3874,7 +3877,8 @@ int JOIN_TAB_SCAN_MRR::next()
|
|||||||
*/
|
*/
|
||||||
DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) &&
|
DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) &&
|
||||||
(uchar *) (*ptr) <= cache->end_pos);
|
(uchar *) (*ptr) <= cache->end_pos);
|
||||||
update_virtual_fields(join->thd, join_tab->table);
|
if (join_tab->table->vfield)
|
||||||
|
update_virtual_fields(join->thd, join_tab->table);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -8078,7 +8078,8 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
|
|||||||
error= 1;
|
error= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
update_virtual_fields(thd, from);
|
if (from->vfield)
|
||||||
|
update_virtual_fields(thd, from);
|
||||||
thd->row_count++;
|
thd->row_count++;
|
||||||
if (++thd->progress.counter >= time_to_report_progress)
|
if (++thd->progress.counter >= time_to_report_progress)
|
||||||
{
|
{
|
||||||
@ -8106,7 +8107,8 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
|
|||||||
copy_ptr->do_copy(copy_ptr);
|
copy_ptr->do_copy(copy_ptr);
|
||||||
}
|
}
|
||||||
prev_insert_id= to->file->next_insert_id;
|
prev_insert_id= to->file->next_insert_id;
|
||||||
update_virtual_fields(thd, to, TRUE);
|
if (to->vfield)
|
||||||
|
update_virtual_fields(thd, to, TRUE);
|
||||||
if (thd->is_error())
|
if (thd->is_error())
|
||||||
{
|
{
|
||||||
error= 1;
|
error= 1;
|
||||||
|
@ -506,7 +506,8 @@ int mysql_update(THD *thd,
|
|||||||
|
|
||||||
while (!(error=info.read_record(&info)) && !thd->killed)
|
while (!(error=info.read_record(&info)) && !thd->killed)
|
||||||
{
|
{
|
||||||
update_virtual_fields(thd, table);
|
if (table->vfield)
|
||||||
|
update_virtual_fields(thd, table);
|
||||||
thd->examined_row_count++;
|
thd->examined_row_count++;
|
||||||
if (!select || (error= select->skip_record(thd)) > 0)
|
if (!select || (error= select->skip_record(thd)) > 0)
|
||||||
{
|
{
|
||||||
@ -621,7 +622,8 @@ int mysql_update(THD *thd,
|
|||||||
|
|
||||||
while (!(error=info.read_record(&info)) && !thd->killed)
|
while (!(error=info.read_record(&info)) && !thd->killed)
|
||||||
{
|
{
|
||||||
update_virtual_fields(thd, table);
|
if (table->vfield)
|
||||||
|
update_virtual_fields(thd, table);
|
||||||
thd->examined_row_count++;
|
thd->examined_row_count++;
|
||||||
if (!select || select->skip_record(thd) > 0)
|
if (!select || select->skip_record(thd) > 0)
|
||||||
{
|
{
|
||||||
|
@ -5759,8 +5759,7 @@ int update_virtual_fields(THD *thd, TABLE *table, bool for_write)
|
|||||||
DBUG_ENTER("update_virtual_fields");
|
DBUG_ENTER("update_virtual_fields");
|
||||||
Field **vfield_ptr, *vfield;
|
Field **vfield_ptr, *vfield;
|
||||||
int error __attribute__ ((unused))= 0;
|
int error __attribute__ ((unused))= 0;
|
||||||
if (!table || !table->vfield)
|
DBUG_ASSERT(table && table->vfield);
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
|
||||||
thd->reset_arena_for_cached_items(table->expr_arena);
|
thd->reset_arena_for_cached_items(table->expr_arena);
|
||||||
/* Iterate over virtual fields in the table */
|
/* Iterate over virtual fields in the table */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user