mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
bug#926 fix undone - it caused suboptimal execution plan for "range ON, no WHERE" query
Another fix applied
This commit is contained in:
@ -2663,13 +2663,30 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||||||
join->thd->select_limit < join->best_positions[i].records_read &&
|
join->thd->select_limit < join->best_positions[i].records_read &&
|
||||||
!(join->select_options & OPTION_FOUND_ROWS)))
|
!(join->select_options & OPTION_FOUND_ROWS)))
|
||||||
{
|
{
|
||||||
|
/* Join with outer join condition */
|
||||||
|
COND *orig_cond=sel->cond;
|
||||||
|
sel->cond=and_conds(sel->cond,tab->on_expr);
|
||||||
if (sel->test_quick_select(tab->keys,
|
if (sel->test_quick_select(tab->keys,
|
||||||
used_tables & ~ current_map,
|
used_tables & ~ current_map,
|
||||||
(join->select_options &
|
(join->select_options &
|
||||||
OPTION_FOUND_ROWS ?
|
OPTION_FOUND_ROWS ?
|
||||||
HA_POS_ERROR :
|
HA_POS_ERROR :
|
||||||
join->thd->select_limit)) < 0)
|
join->thd->select_limit)) < 0)
|
||||||
DBUG_RETURN(1); // Impossible range
|
{ /* before reporting "Impossible WHERE" for the whole query
|
||||||
|
we have to check isn't it only "impossible ON" instead */
|
||||||
|
sel->cond=orig_cond;
|
||||||
|
if (!tab->on_expr ||
|
||||||
|
sel->test_quick_select(tab->keys,
|
||||||
|
used_tables & ~ current_map,
|
||||||
|
(join->select_options &
|
||||||
|
OPTION_FOUND_ROWS ?
|
||||||
|
HA_POS_ERROR :
|
||||||
|
join->thd->select_limit)) < 0)
|
||||||
|
DBUG_RETURN(1); // Impossible WHERE
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sel->cond=orig_cond;
|
||||||
|
|
||||||
/* Fix for EXPLAIN */
|
/* Fix for EXPLAIN */
|
||||||
if (sel->quick)
|
if (sel->quick)
|
||||||
join->best_positions[i].records_read= sel->quick->records;
|
join->best_positions[i].records_read= sel->quick->records;
|
||||||
|
Reference in New Issue
Block a user