当前位置:网站首页>2022-07-13 comparison of fast subquery and slow subquery execution of mysql/stonedb
2022-07-13 comparison of fast subquery and slow subquery execution of mysql/stonedb
2022-07-22 15:06:00 【Emperor Zunwu world】
Catalog
Abstract :
contrast mysql/stonedb Fast subquery and slow subquery
Quick sub query :
SQL sentence :
/stonedb57/install/bin/mysql -D tpch -e "select
o_orderpriority,
count(*) as order_count
from
orders
where
o_orderdate >= date '1993-07-01'
and o_orderdate < date '1993-07-01' + interval '3' month
and exists (
select
*
from
lineitem
where
l_shipdate < date '1993-07-01'
)
group by
o_orderpriority
order by
o_orderpriority ;"
Core function :
eval_const_cond
/**
Evaluate a constant condition, represented by an Item tree
@param thd Thread handler
@param cond The constant condition to evaluate
@param[out] value Returned value, either true or false
@returns false if evaluation is successful, true otherwise
*/
bool eval_const_cond(THD *thd, Item *cond, bool *value)
{
assert(cond->const_item());
*value= cond->val_int();
return thd->is_error();
}
(gdb) bt
#0 eval_const_cond (thd=0x7feb88012770, cond=0x7feb880012f8, value=0x7fede9aaf342) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/item_func.cc:81
#1 0x000000000245ba02 in internal_remove_eq_conds (thd=0x7feb88012770, cond=0x7feb880012f8, retcond=0x7fede9aaf428, cond_value=0x7fede9aaf424, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10303
#2 0x000000000245b446 in internal_remove_eq_conds (thd=0x7feb88012770, cond=0x7feb880108a0, retcond=0x7feb88001f78, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10157
#3 0x000000000245be68 in remove_eq_conds (thd=0x7feb88012770, cond=0x7feb880108a0, retcond=0x7feb88001f78, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10403
#4 0x000000000245b0e4 in optimize_cond (thd=0x7feb88012770, cond=0x7feb88001f78, cond_equal=0x7feb88001f98, join_list=0x7feb8800f5f0, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10114
#5 0x0000000002442b39 in JOIN::optimize (this=0x7feb88001c78, part=1 '\001') at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:263
#6 0x0000000002d43ec5 in stonedb::core::optimize_select (thd=0x7feb88012770, select_options=2147748608, result=0x7feb88001730, select_lex=0x7feb8800f450,
[email protected]: 1, [email protected]: 1) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:352
#7 0x0000000002d43778 in stonedb::core::Engine::HandleSelect (this=0x6e9dc60, thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001730, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:225
#8 0x0000000002e2bfaf in stonedb::dbhandler::SDB_HandleSelect (thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001730, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/handler/ha_rcengine.cpp:82
#9 0x000000000246f92a in execute_sqlcom_select (thd=0x7feb88012770, all_tables=0x7feb8801b1b8) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5182
#10 0x0000000002468cae in mysql_execute_command (thd=0x7feb88012770, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:2831
#11 0x00000000024708f3 in mysql_parse (thd=0x7feb88012770, parser_state=0x7fede9ab0eb0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5621
#12 0x0000000002465b8b in dispatch_command (thd=0x7feb88012770, com_data=0x7fede9ab1650, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1495
#13 0x0000000002464ab7 in do_command (thd=0x7feb88012770) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1034
#14 0x00000000025976d3 in handle_connection (arg=0x82af6e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/conn_handler/connection_handler_per_thread.cc:313
#15 0x0000000002c7b304 in pfs_spawn_thread (arg=0x82b02e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/perfschema/pfs.cc:2197
#16 0x00007fee388e4ea5 in start_thread () from /lib64/libpthread.so.0
#17 0x00007fee36d1bb0d in clone () from /lib64/libc.so.6
internal_remove_eq_conds
/**
Handle the recursive job for remove_eq_conds()
@param thd Thread handler
@param cond the condition to handle.
@param[out] retcond Modified condition after removal
@param[out] cond_value the resulting value of the condition
@see remove_eq_conds() for more details on argument
@returns false if success, true if error
*/
static bool internal_remove_eq_conds(THD *thd, Item *cond,
Item **retcond,
Item::cond_result *cond_value,
unsigned char part)
{
if (cond->type() == Item::COND_ITEM)
{
Item_cond *const item_cond= down_cast<Item_cond *>(cond);
const bool and_level= item_cond->functype() == Item_func::COND_AND_FUNC;
List_iterator<Item> li(*item_cond->argument_list());
bool should_fix_fields= false;
*cond_value=Item::COND_UNDEF;
Item *item;
while ((item=li++))
{
Item *new_item;
Item::cond_result tmp_cond_value;
if (internal_remove_eq_conds(thd, item, &new_item, &tmp_cond_value, part))
return true;
if (new_item == NULL)
li.remove();
else if (item != new_item)
{
(void) li.replace(new_item);
should_fix_fields= true;
}
if (*cond_value == Item::COND_UNDEF)
*cond_value= tmp_cond_value;
switch (tmp_cond_value)
{
case Item::COND_OK: // Not TRUE or FALSE
if (and_level || *cond_value == Item::COND_FALSE)
*cond_value= tmp_cond_value;
break;
case Item::COND_FALSE:
if (and_level) // Always false
{
*cond_value= tmp_cond_value;
*retcond= NULL;
return false;
}
break;
case Item::COND_TRUE:
if (!and_level) // Always true
{
*cond_value= tmp_cond_value;
*retcond= NULL;
return false;
}
break;
case Item::COND_UNDEF: // Impossible
assert(false); /* purecov: deadcode */
}
}
if (should_fix_fields)
item_cond->update_used_tables();
if (item_cond->argument_list()->elements == 0 ||
*cond_value != Item::COND_OK)
{
*retcond= NULL;
return false;
}
if (item_cond->argument_list()->elements == 1)
{
/*
BUG#11765699:
We're dealing with an AND or OR item that has only one
argument. However, it is not an option to empty the list
because:
- this function is called for either JOIN::conds or
JOIN::having, but these point to the same condition as
SELECT_LEX::where and SELECT_LEX::having do.
- The return value of remove_eq_conds() is assigned to
JOIN::conds and JOIN::having, so emptying the list and
returning the only remaining item "replaces" the AND or OR
with item for the variables in JOIN. However, the return
value is not assigned to the SELECT_LEX counterparts. Thus,
if argument_list is emptied, SELECT_LEX forgets the item in
argument_list()->head().
item is therefore returned, but argument_list is not emptied.
*/
item= item_cond->argument_list()->head();
/*
Consider reenabling the line below when the optimizer has been
split into properly separated phases.
item_cond->argument_list()->empty();
*/
*retcond= item;
return false;
}
}
else if (cond->type() == Item::FUNC_ITEM &&
down_cast<Item_func *>(cond)->functype() == Item_func::ISNULL_FUNC)
{
Item_func_isnull *const func= down_cast<Item_func_isnull *>(cond);
Item **args= func->arguments();
if (args[0]->type() == Item::FIELD_ITEM)
{
Field *const field= down_cast<Item_field *>(args[0])->field;
/* fix to replace 'NULL' dates with '0' ([email protected]) */
/*
See BUG#12594011
Documentation says that
SELECT datetime_notnull d FROM t1 WHERE d IS NULL
shall return rows where d=='0000-00-00'
Thus, for DATE and DATETIME columns defined as NOT NULL,
"date_notnull IS NULL" has to be modified to
"date_notnull IS NULL OR date_notnull == 0" (if outer join)
"date_notnull == 0" (otherwise)
*/
if (((field->type() == MYSQL_TYPE_DATE) ||
(field->type() == MYSQL_TYPE_DATETIME)) &&
(field->flags & NOT_NULL_FLAG))
{
Item *item0= new(thd->mem_root) Item_int((longlong)0, 1);
if (item0 == NULL)
return true;
Item *eq_cond= new(thd->mem_root) Item_func_eq(args[0], item0);
if (eq_cond == NULL)
return true;
if (args[0]->is_outer_field())
{
// outer join: transform "col IS NULL" to "col IS NULL or col=0"
Item *or_cond= new(thd->mem_root) Item_cond_or(eq_cond, cond);
if (or_cond == NULL)
return true;
cond= or_cond;
}
else
{
// not outer join: transform "col IS NULL" to "col=0"
cond= eq_cond;
}
if (cond->fix_fields(thd, &cond))
return true;
}
}
if (cond->const_item())
{
if (part!=1 || cond->type()!=Item::SUBSELECT_ITEM)
{//STONEDB UPGRADE
bool value;
if (eval_const_cond(thd, cond, &value))
return true;
*cond_value= value ? Item::COND_TRUE : Item::COND_FALSE;
*retcond= NULL;
}//END
return false;
}
}
else if (cond->const_item() && !cond->is_expensive())
{
bool value;
if (eval_const_cond(thd, cond, &value))
return true;
*cond_value= value ? Item::COND_TRUE : Item::COND_FALSE;
*retcond= NULL;
return false;
}
else
{ // boolan compare function
*cond_value= cond->eq_cmp_result();
if (*cond_value == Item::COND_OK)
{
*retcond= cond;
return false;
}
Item *left_item= down_cast<Item_func *>(cond)->arguments()[0];
Item *right_item= down_cast<Item_func *>(cond)->arguments()[1];
if (left_item->eq(right_item,1))
{
if (!left_item->maybe_null ||
down_cast<Item_func *>(cond)->functype() == Item_func::EQUAL_FUNC)
{
*retcond= NULL;
return false; // Compare of identical items
}
}
}
*cond_value= Item::COND_OK;
*retcond= cond; // Point at next and level
return false;
}
#1 0x000000000245ba02 in internal_remove_eq_conds (thd=0x7feb88012770, cond=0x7feb880012f8, retcond=0x7fede9aaf428, cond_value=0x7fede9aaf424, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10303
#2 0x000000000245b446 in internal_remove_eq_conds (thd=0x7feb88012770, cond=0x7feb880108a0, retcond=0x7feb88001f78, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10157
#3 0x000000000245be68 in remove_eq_conds (thd=0x7feb88012770, cond=0x7feb880108a0, retcond=0x7feb88001f78, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10403
#4 0x000000000245b0e4 in optimize_cond (thd=0x7feb88012770, cond=0x7feb88001f78, cond_equal=0x7feb88001f98, join_list=0x7feb8800f5f0, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10114
#5 0x0000000002442b39 in JOIN::optimize (this=0x7feb88001c78, part=1 '\001') at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:263
#6 0x0000000002d43ec5 in stonedb::core::optimize_select (thd=0x7feb88012770, select_options=2147748608, result=0x7feb88001730, select_lex=0x7feb8800f450,
[email protected]: 1, [email protected]: 1) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:352
#7 0x0000000002d43778 in stonedb::core::Engine::HandleSelect (this=0x6e9dc60, thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001730, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:225
#8 0x0000000002e2bfaf in stonedb::dbhandler::SDB_HandleSelect (thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001730, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/handler/ha_rcengine.cpp:82
#9 0x000000000246f92a in execute_sqlcom_select (thd=0x7feb88012770, all_tables=0x7feb8801b1b8) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5182
#10 0x0000000002468cae in mysql_execute_command (thd=0x7feb88012770, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:2831
#11 0x00000000024708f3 in mysql_parse (thd=0x7feb88012770, parser_state=0x7fede9ab0eb0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5621
#12 0x0000000002465b8b in dispatch_command (thd=0x7feb88012770, com_data=0x7fede9ab1650, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1495
#13 0x0000000002464ab7 in do_command (thd=0x7feb88012770) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1034
#14 0x00000000025976d3 in handle_connection (arg=0x82af6e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/conn_handler/connection_handler_per_thread.cc:313
#15 0x0000000002c7b304 in pfs_spawn_thread (arg=0x82b02e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/perfschema/pfs.cc:2197
#16 0x00007fee388e4ea5 in start_thread () from /lib64/libpthread.so.0
#17 0x00007fee36d1bb0d in clone () from /lib64/libc.so.6
optimize_cond
/**
Optimize conditions by
a) applying transitivity to build multiple equality predicates
(MEP): if x=y and y=z the MEP x=y=z is built.
b) apply constants where possible. If the value of x is known to be
42, x is replaced with a constant of value 42. By transitivity, this
also applies to MEPs, so the MEP in a) will become 42=x=y=z.
c) remove conditions that are always false or always true
@param thd Thread handler
@param[in,out] cond WHERE or HAVING condition to optimize
@param[out] cond_equal The built multiple equalities
@param join_list list of join operations with join conditions
= NULL: Called for HAVING condition
@param[out] cond_value Not changed if cond was empty
COND_TRUE if cond is always true
COND_FALSE if cond is impossible
COND_OK otherwise
@returns false if success, true if error
*/
bool optimize_cond(THD *thd, Item **cond, COND_EQUAL **cond_equal,
List<TABLE_LIST> *join_list,
Item::cond_result *cond_value,
unsigned char part)//STONEDB UPGRADE
{
Opt_trace_context * const trace= &thd->opt_trace;
DBUG_ENTER("optimize_cond");
Opt_trace_object trace_wrapper(trace);
Opt_trace_object trace_cond(trace, "condition_processing");
trace_cond.add_alnum("condition", join_list ? "WHERE" : "HAVING");
trace_cond.add("original_condition", *cond);
Opt_trace_array trace_steps(trace, "steps");
/*
Enter this function
a) For a WHERE condition or a query having outer join.
b) For a HAVING condition.
*/
assert(*cond || join_list);
/*
Build all multiple equality predicates and eliminate equality
predicates that can be inferred from these multiple equalities.
For each reference of a field included into a multiple equality
that occurs in a function set a pointer to the multiple equality
predicate. Substitute a constant instead of this field if the
multiple equality contains a constant.
This is performed for the WHERE condition and any join conditions, but
not for the HAVING condition.
*/
if (part == 0 || part == 1)
{
if (join_list)
{
Opt_trace_object step_wrapper(trace);
step_wrapper.add_alnum("transformation", "equality_propagation");
{
Opt_trace_disable_I_S disable_trace_wrapper(
trace, !(*cond && (*cond)->has_subquery()));
Opt_trace_array trace_subselect(trace, "subselect_evaluation");
if (build_equal_items(thd, *cond, cond, NULL, true, join_list,
cond_equal))
DBUG_RETURN(true);
}
step_wrapper.add("resulting_condition", *cond);
}
}
/* change field = field to field = const for each found field = const */
if (*cond)
{
//
if (part==0 || part==1)
{
Opt_trace_object step_wrapper(trace);
step_wrapper.add_alnum("transformation", "constant_propagation");
{
Opt_trace_disable_I_S
disable_trace_wrapper(trace, !(*cond)->has_subquery());
Opt_trace_array trace_subselect(trace, "subselect_evaluation");
if (propagate_cond_constants(thd, NULL, *cond, *cond))
DBUG_RETURN(true);
}
step_wrapper.add("resulting_condition", *cond);
/*
Remove all instances of item == item
Remove all and-levels where CONST item != CONST item
*/
DBUG_EXECUTE("where",print_where(*cond,"after const change", QT_ORDINARY););
}
}//ATOMRESTORE UPGRADE
if (*cond)
{
Opt_trace_object step_wrapper(trace);
step_wrapper.add_alnum("transformation", "trivial_condition_removal");
{
Opt_trace_disable_I_S
disable_trace_wrapper(trace, !(*cond)->has_subquery());
Opt_trace_array trace_subselect(trace, "subselect_evaluation");
if (remove_eq_conds(thd, *cond, cond, cond_value, part))
DBUG_RETURN(true);
}
step_wrapper.add("resulting_condition", *cond);
}
assert(!thd->is_error());
if (thd->is_error())
DBUG_RETURN(true);
DBUG_RETURN(false);
}
#4 0x000000000245b0e4 in optimize_cond (thd=0x7feb88012770, cond=0x7feb88001f78, cond_equal=0x7feb88001f98, join_list=0x7feb8800f5f0, cond_value=0x7feb8800f538, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10114
#5 0x0000000002442b39 in JOIN::optimize (this=0x7feb88001c78, part=1 '\001') at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:263
#6 0x0000000002d43ec5 in stonedb::core::optimize_select (thd=0x7feb88012770, select_options=2147748608, result=0x7feb88001730, select_lex=0x7feb8800f450,
[email protected]: 1, [email protected]: 1) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:352
#7 0x0000000002d43778 in stonedb::core::Engine::HandleSelect (this=0x6e9dc60, thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001730, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:225
#8 0x0000000002e2bfaf in stonedb::dbhandler::SDB_HandleSelect (thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001730, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/handler/ha_rcengine.cpp:82
#9 0x000000000246f92a in execute_sqlcom_select (thd=0x7feb88012770, all_tables=0x7feb8801b1b8) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5182
#10 0x0000000002468cae in mysql_execute_command (thd=0x7feb88012770, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:2831
#11 0x00000000024708f3 in mysql_parse (thd=0x7feb88012770, parser_state=0x7fede9ab0eb0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5621
#12 0x0000000002465b8b in dispatch_command (thd=0x7feb88012770, com_data=0x7fede9ab1650, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1495
#13 0x0000000002464ab7 in do_command (thd=0x7feb88012770) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1034
#14 0x00000000025976d3 in handle_connection (arg=0x82af6e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/conn_handler/connection_handler_per_thread.cc:313
#15 0x0000000002c7b304 in pfs_spawn_thread (arg=0x82b02e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/perfschema/pfs.cc:2197
#16 0x00007fee388e4ea5 in start_thread () from /lib64/libpthread.so.0
#17 0x00007fee36d1bb0d in clone () from /lib64/libc.so.6
Slow subquery :
SQL sentence :
/stonedb57/install/bin/mysql -D tpch -e " select
o_orderpriority,
count(*) as order_count
from
orders
where
o_orderdate >= date '1993-07-01'
and o_orderdate < date '1993-07-01' + interval '3' month
and exists (
select
*
from
lineitem
where
l_orderkey = o_orderkey
and l_commitdate < l_receiptdate
)
group by
o_orderpriority
order by
o_orderpriority ;"
Core function :
internal_remove_eq_conds
(gdb) bt
#0 internal_remove_eq_conds (thd=0x7feb88012770, cond=0x7feb8801bda0, retcond=0x7fede9aaf428, cond_value=0x7fede9aaf424, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10311
#1 0x000000000245b446 in internal_remove_eq_conds (thd=0x7feb88012770, cond=0x7feb88010910, retcond=0x7feb88002818, cond_value=0x7feb8800f5a8, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10157
#2 0x000000000245be68 in remove_eq_conds (thd=0x7feb88012770, cond=0x7feb88010910, retcond=0x7feb88002818, cond_value=0x7feb8800f5a8, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10403
#3 0x000000000245b0e4 in optimize_cond (thd=0x7feb88012770, cond=0x7feb88002818, cond_equal=0x7feb88002838, join_list=0x7feb8800f660, cond_value=0x7feb8800f5a8, part=1 '\001')
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:10114
#4 0x0000000002442b39 in JOIN::optimize (this=0x7feb88002518, part=1 '\001') at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_optimizer.cc:263
#5 0x0000000002d43ec5 in stonedb::core::optimize_select (thd=0x7feb88012770, select_options=2147748608, result=0x7feb88001ee0, select_lex=0x7feb8800f4c0,
[email protected]: 1, [email protected]: 1) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:352
#6 0x0000000002d43778 in stonedb::core::Engine::HandleSelect (this=0x6e9dc60, thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001ee0, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/core/engine_execute.cpp:225
#7 0x0000000002e2bfaf in stonedb::dbhandler::SDB_HandleSelect (thd=0x7feb88012770, lex=0x7feb88014a98, [email protected]: 0x7feb88001ee0, setup_tables_done_option=0,
[email protected]: 0, [email protected]: 1, [email protected]: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/stonedb/handler/ha_rcengine.cpp:82
#8 0x000000000246f92a in execute_sqlcom_select (thd=0x7feb88012770, all_tables=0x7feb8801b5b0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5182
#9 0x0000000002468cae in mysql_execute_command (thd=0x7feb88012770, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:2831
#10 0x00000000024708f3 in mysql_parse (thd=0x7feb88012770, parser_state=0x7fede9ab0eb0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:5621
#11 0x0000000002465b8b in dispatch_command (thd=0x7feb88012770, com_data=0x7fede9ab1650, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1495
#12 0x0000000002464ab7 in do_command (thd=0x7feb88012770) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/sql_parse.cc:1034
#13 0x00000000025976d3 in handle_connection (arg=0x82af6e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/sql/conn_handler/connection_handler_per_thread.cc:313
#14 0x0000000002c7b304 in pfs_spawn_thread (arg=0x82b02e0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-vm/storage/perfschema/pfs.cc:2197
#15 0x00007fee388e4ea5 in start_thread () from /lib64/libpthread.so.0
#16 0x00007fee36d1bb0d in clone () from /lib64/libc.so.6
Item_field::eq
bool Item_field::eq(const Item *item, bool binary_cmp) const
{
Item *real_item= ((Item *) item)->real_item();
if (real_item->type() != FIELD_ITEM)
return 0;
Item_field *item_field= (Item_field*) real_item;
if (item_field->field && field)
return item_field->field == field;
/*
We may come here when we are trying to find a function in a GROUP BY
clause from the select list.
In this case the '100 % correct' way to do this would be to first
run fix_fields() on the GROUP BY item and then retry this function, but
I think it's better to relax the checking a bit as we will in
most cases do the correct thing by just checking the field name.
(In cases where we would choose wrong we would have to generate a
ER_NON_UNIQ_ERROR).
*/
return (item_field->item_name.eq_safe(field_name) &&
(!item_field->table_name || !table_name ||
(!my_strcasecmp(table_alias_charset, item_field->table_name,
table_name) &&
(!item_field->db_name || !db_name ||
(item_field->db_name && !strcmp(item_field->db_name,
db_name))))));
}
边栏推荐
- Worthington肽合成应用丨胰凝乳蛋白酶方案
- 1234556666
- Hcia-r & s self use notes (15) OSPF foundation, OSPF core workflow, OSPF packet type, OSPF neighbor establishment conditions and process
- 力扣(LeetCode)202. 快乐数(2022.07.21)
- 2022-07-12 使用perf统计mysql执行的性能
- 2022-07-18 subquery - optimize the processing of the join query optimizer in the exists scenario
- Excel file parsing
- 1382. 将二叉搜索树变平衡 ●●
- 排错-通过LLDP信息查找环路(以H3C S5100为例)
- Hcia-r & s self use notes (13) case analysis of typical routing problems and overview of dynamic routing
猜你喜欢
[AGC] build service 1- cloud function example
2022-07-18 subquery - optimize the processing of the join query optimizer in the exists scenario
【MySQL系列】MySQL数据库基础
687. 最长同值路径 ●●
HCIA-R&S自用笔记(17)OSPF实验与路由综合实验
矽穀課堂筆記(下)
Sequence table and linked list (sequence table)
[harmony OS] [ark UI] [demo] loading animation
[harmonyos] [FAQ] Hongmeng problem collection 4
MATLAB basic grammar (I)
随机推荐
Worthington植物原生质体制备丨纤维素酶方案
winodos下配置laradock
测试下投票的功能
[must see for developers] [push kit] collection of typical problems of push service 3
MSTP & VRRP protocol
[harmonyos] [ark UI] how does harmonyos ETS language realize double clicking the return key to exit
1234556666
滑环的分类以及用途
378. The k-th smallest element in the ordered matrix ●●
某视频app分析样本
2022.7.11-7.17 AI行业周刊(第106期):竭尽全力,努力就好
测试下定时发布的时间
How to solve the "last mile of delivery" of community group purchase
Hcia-r & s self use notes (17) OSPF experiment and routing comprehensive experiment
2022.7.11-7.17 AI industry weekly (issue 106): just try your best
1.openpyxl 打开工作簿
2022-07-18 子查詢-優化exists場景的join查詢優化器的處理
AOSP ~ camera - rk hal3 (II)
Worthington真菌分泌酶研究 丨半乳糖氧化酶方案
687. Longest same value path ●●