mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Subquery cache (MWL#66) added.
libmysqld/Makefile.am: The new file added. mysql-test/r/index_merge_myisam.result: subquery_cache optimization option added. mysql-test/r/myisam_mrr.result: subquery_cache optimization option added. mysql-test/r/subquery_cache.result: The subquery cache tests added. mysql-test/r/subselect3.result: Subquery cache switched off to avoid changing read statistics. mysql-test/r/subselect3_jcl6.result: Subquery cache switched off to avoid changing read statistics. mysql-test/r/subselect_no_mat.result: subquery_cache optimization option added. mysql-test/r/subselect_no_opts.result: subquery_cache optimization option added. mysql-test/r/subselect_no_semijoin.result: subquery_cache optimization option added. mysql-test/r/subselect_sj.result: subquery_cache optimization option added. mysql-test/r/subselect_sj_jcl6.result: subquery_cache optimization option added. mysql-test/t/subquery_cache.test: The subquery cache tests added. mysql-test/t/subselect3.test: Subquery cache switched off to avoid changing read statistics. sql/CMakeLists.txt: The new file added. sql/Makefile.am: The new files added. sql/item.cc: Expression cache item (Item_cache_wrapper) added. Item_ref and Item_field fixed for correct usage of result field and fast resolwing in SP. sql/item.h: Expression cache item (Item_cache_wrapper) added. Item_ref and Item_field fixed for correct usage of result field and fast resolwing in SP. sql/item_cmpfunc.cc: Subquery cache added. sql/item_cmpfunc.h: Subquery cache added. sql/item_subselect.cc: Subquery cache added. sql/item_subselect.h: Subquery cache added. sql/item_sum.cc: Registration of subquery parameters added. sql/mysql_priv.h: subquery_cache optimization option added. sql/mysqld.cc: subquery_cache optimization option added. sql/opt_range.cc: Fix due to subquery cache. sql/opt_subselect.cc: Parameters of the function cahnged. sql/procedure.h: .h file guard added. sql/sql_base.cc: Registration of subquery parameters added. sql/sql_class.cc: Option to allow add indeces to temporary table. sql/sql_class.h: Item iterators added. Option to allow add indeces to temporary table. sql/sql_expression_cache.cc: Expression cache for caching subqueries added. sql/sql_expression_cache.h: Expression cache for caching subqueries added. sql/sql_lex.cc: Registration of subquery parameters added. sql/sql_lex.h: Registration of subqueries and subquery parameters added. sql/sql_select.cc: Subquery cache added. sql/sql_select.h: Subquery cache added. sql/sql_union.cc: A new parameter to the function added. sql/sql_update.cc: A new parameter to the function added. sql/table.cc: Procedures to manage temporarty tables index added. sql/table.h: Procedures to manage temporarty tables index added. storage/maria/ha_maria.cc: Fix of handler to allow destoy a table in case of error during the table creation. storage/maria/ha_maria.h: .h file guard added. storage/myisam/ha_myisam.cc: Fix of handler to allow destoy a table in case of error during the table creation.
This commit is contained in:
@ -1375,10 +1375,10 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
|
||||
bool found_old_table= 0;
|
||||
TABLE *table= *table_ptr;
|
||||
DBUG_ENTER("close_thread_table");
|
||||
DBUG_ASSERT(table->key_read == 0);
|
||||
DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
|
||||
DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
|
||||
table->s->table_name.str, (long) table));
|
||||
DBUG_ASSERT(table->key_read == 0);
|
||||
DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
|
||||
|
||||
if (table->file)
|
||||
{
|
||||
@ -6328,12 +6328,21 @@ find_field_in_tables(THD *thd, Item_ident *item,
|
||||
sub query as dependent on the outer query
|
||||
*/
|
||||
if (current_sel != last_select)
|
||||
{
|
||||
mark_select_range_as_dependent(thd, last_select, current_sel,
|
||||
found, *ref, item);
|
||||
if (item->can_be_depended)
|
||||
{
|
||||
DBUG_ASSERT((*ref) == (Item*)item);
|
||||
current_sel->register_dependency_item(last_select, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
}
|
||||
else
|
||||
item->can_be_depended= TRUE;
|
||||
|
||||
if (db && lower_case_table_names)
|
||||
{
|
||||
@ -8083,6 +8092,10 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
|
||||
if (*conds)
|
||||
{
|
||||
thd->where="where clause";
|
||||
DBUG_EXECUTE("where",
|
||||
print_where(*conds,
|
||||
"WHERE in setup_conds",
|
||||
QT_ORDINARY););
|
||||
if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) ||
|
||||
(*conds)->check_cols(1))
|
||||
goto err_no_arena;
|
||||
@ -8341,6 +8354,7 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
|
||||
ptr pointer on pointer to record
|
||||
values list of fields
|
||||
ignore_errors TRUE if we should ignore errors
|
||||
use_value forces usage of value of the items instead of result
|
||||
|
||||
NOTE
|
||||
fill_record() may set table->auto_increment_field_not_null and a
|
||||
@ -8353,7 +8367,8 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
|
||||
*/
|
||||
|
||||
bool
|
||||
fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
|
||||
fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors,
|
||||
bool use_value)
|
||||
{
|
||||
List_iterator_fast<Item> v(values);
|
||||
List<TABLE> tbl_list;
|
||||
@ -8395,8 +8410,11 @@ fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
|
||||
field->field_name, table->s->table_name.str);
|
||||
thd->abort_on_warning= abort_on_warning_saved;
|
||||
}
|
||||
if (value->save_in_field(field, 0) < 0)
|
||||
goto err;
|
||||
if (use_value)
|
||||
value->save_val(field);
|
||||
else
|
||||
if (value->save_in_field(field, 0) < 0)
|
||||
goto err;
|
||||
tbl_list.push_back(table);
|
||||
}
|
||||
/* Update virtual fields*/
|
||||
@ -8465,7 +8483,7 @@ fill_record_n_invoke_before_triggers(THD *thd, Field **ptr,
|
||||
enum trg_event_type event)
|
||||
{
|
||||
bool result;
|
||||
result= (fill_record(thd, ptr, values, ignore_errors) ||
|
||||
result= (fill_record(thd, ptr, values, ignore_errors, FALSE) ||
|
||||
(triggers && triggers->process_triggers(thd, event,
|
||||
TRG_ACTION_BEFORE, TRUE)));
|
||||
/*
|
||||
|
Reference in New Issue
Block a user