diff options
author | unknown <monty@hundin.mysql.fi> | 2001-09-27 22:02:37 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-09-27 22:02:37 +0300 |
commit | 0edc02d65348fb3fb1c2d814d8ff5eececdec7cf (patch) | |
tree | efc338d3f173438bf497cfc5ec22271876b39af5 /sql | |
parent | e47b763f869180053a9cd22a8688bfa04bdb6f3a (diff) | |
download | mariadb-git-0edc02d65348fb3fb1c2d814d8ff5eececdec7cf.tar.gz |
Fixed bug in counting open files when using many files
Fixed bug in JOIN
Docs/manual.texi:
Changlog
mysql-test/r/join.result:
New test for join bug
mysql-test/r/null_key.result:
Fix result after fixing join bug
mysql-test/t/join.test:
New test for join bug
mysys/my_open.c:
Fixed bug in counting open files when using many files.
sql/sql_select.cc:
Fixed join bug
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 24 |
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; - } } } } |