summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authormonty@work.mysql.com <>2001-09-28 06:28:04 +0200
committermonty@work.mysql.com <>2001-09-28 06:28:04 +0200
commit390e57687b237cd6d54270592f66897331da7820 (patch)
treea6b1c8b90c5b9593ce01cf029acb8150d80a1922 /sql/sql_select.cc
parenta80e32a4073eaa7428347af5fda8ca6b873d90bb (diff)
parent641ac16c712f4648e1ddc28d40e4fa0af2406ed8 (diff)
downloadmariadb-git-390e57687b237cd6d54270592f66897331da7820.tar.gz
merge
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3aa534222e7..367b1d55a36 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2332,7 +2332,20 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{
JOIN_TAB *tab=join->join_tab+i;
table_map current_map= tab->table->map;
+ bool use_quick_range=0;
used_tables|=current_map;
+
+ if (tab->type == JT_REF && tab->quick &&
+ tab->ref.key_length < tab->quick->max_used_key_length)
+ {
+ /* Range uses longer key; Use this instead of ref on key */
+ tab->type=JT_ALL;
+ use_quick_range=1;
+ tab->use_quick=1;
+ tab->ref.key_parts=0; // Don't use ref key.
+ join->best_positions[i].records_read=tab->quick->records;
+ }
+
COND *tmp=make_cond_for_table(cond,used_tables,current_map);
if (!tmp && tab->quick)
{ // Outer join
@@ -2375,7 +2388,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (tab->const_keys && tab->table->reginfo.impossible_range)
DBUG_RETURN(1);
}
- else if (tab->type == JT_ALL)
+ else if (tab->type == JT_ALL && ! use_quick_range)
{
if (tab->const_keys &&
tab->table->reginfo.impossible_range)
@@ -2434,15 +2447,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
}
}
- if (tab->type == JT_REF && sel->quick &&
- tab->ref.key_length < sel->quick->max_used_key_length)
- {
- /* Range uses longer key; Use this instead of ref on key */
- tab->type=JT_ALL;
- tab->use_quick=1;
- tab->ref.key_parts=0; // Don't use ref key.
- join->best_positions[i].records_read=sel->quick->records;
- }
}
}
}