summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-09-27 22:02:37 +0300
committermonty@hundin.mysql.fi <>2001-09-27 22:02:37 +0300
commita4bc23add63c1eb20e6bb6cd65fa761b2ec2c19b (patch)
treeefc338d3f173438bf497cfc5ec22271876b39af5 /sql/sql_select.cc
parentc3722dc1f4f4a6f74bd285b0ba59d4b82b0c52dc (diff)
downloadmariadb-git-a4bc23add63c1eb20e6bb6cd65fa761b2ec2c19b.tar.gz
Fixed bug in counting open files when using many files
Fixed bug in JOIN
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 56ba4baed30..e97fa3b0abf 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2258,7 +2258,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
@@ -2301,7 +2314,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)
@@ -2356,15 +2369,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;
- }
}
}
}