diff options
author | unknown <igor@rurik.mysql.com> | 2004-09-02 22:06:30 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2004-09-02 22:06:30 -0700 |
commit | 76936acef507d98c35dfb0500ea2bd7a02f2f83f (patch) | |
tree | 0a2fb6ed09ccf0be9c7f6da755d585bdd8c916eb /sql/sql_select.cc | |
parent | b33b4c274866fc0f90118d0ecff35e8b8f0aaf98 (diff) | |
download | mariadb-git-76936acef507d98c35dfb0500ea2bd7a02f2f83f.tar.gz |
select.result, select.test:
Added a test case for bug #5333.
null_key.result, key_primary.result:
Made covering index usable for const tables.
sql_select.cc:
Made covering index usable for const tables:
downported the corresponding code from 4.1.
Simultaneously fixed bug #5333 reported for 4.1.
The bug was due to the fact that field index in join
structures was always set to 0 for const tables.
sql/sql_select.cc:
Made covering index usable for const tables:
downported the corresponding code from 4.1.
Simultaneously fixed bug #5333 reported for 4.1.
The bug was due to the fact that field index in join
structures was always set to 0 for const tables.
mysql-test/t/select.test:
Added a test case for bug #5333.
mysql-test/r/key_primary.result:
Made covering index usable for const tables.
mysql-test/r/null_key.result:
Made covering index usable for const tables.
mysql-test/r/select.result:
Added a test case for bug #5333.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 882f345a1ca..d2b9f9d4588 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4901,6 +4901,15 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos) } else { + if (!table->key_read && + (table->used_keys & ((key_map) 1 << tab->ref.key)) && + !table->no_keyread && + (int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY) + { + table->key_read=1; + table->file->extra(HA_EXTRA_KEYREAD); + tab->index= tab->ref.key; + } if ((error=join_read_const(tab))) { tab->info="unique row not found"; @@ -7617,7 +7626,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, sprintf(buff3,"%.0f",join->best_positions[i].records_read); item_list.push_back(new Item_string(buff3,strlen(buff3))); my_bool key_read=table->key_read; - if (tab->type == JT_NEXT && + if ((tab->type == JT_NEXT || tab->type == JT_CONST) && ((table->used_keys & ((key_map) 1 << tab->index)))) key_read=1; |