diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-10-19 17:36:19 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-10-19 17:36:19 +0400 |
commit | bd60794fd8e532616f5b5f6d2200af0f4c7bc5ef (patch) | |
tree | ab9b420b768d8a6eb5ccda680604108cfee71b81 /sql/table.cc | |
parent | 6b684c5806e0728b42c5c0ab7ae9939ab9dfec93 (diff) | |
parent | 03bf73de2fc2df414cafff03c8aaf3a58a3e7e48 (diff) | |
download | mariadb-git-bd60794fd8e532616f5b5f6d2200af0f4c7bc5ef.tar.gz |
Merge from mysql-trunk-merge.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sql/table.cc b/sql/table.cc index bd4495eb6ce..81b5410f7cc 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4638,7 +4638,8 @@ Item_subselect *TABLE_LIST::containing_subselect() (TABLE_LIST::index_hints). Using the information in this tagged list this function sets the members st_table::keys_in_use_for_query, st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by, - st_table::force_index and st_table::covering_keys. + st_table::force_index, st_table::force_index_order, + st_table::force_index_group and st_table::covering_keys. Current implementation of the runtime does not allow mixing FORCE INDEX and USE INDEX, so this is checked here. Then the FORCE INDEX list @@ -4766,14 +4767,28 @@ bool TABLE_LIST::process_index_hints(TABLE *tbl) } /* process FORCE INDEX as USE INDEX with a flag */ + if (!index_order[INDEX_HINT_FORCE].is_clear_all()) + { + tbl->force_index_order= TRUE; + index_order[INDEX_HINT_USE].merge(index_order[INDEX_HINT_FORCE]); + } + + if (!index_group[INDEX_HINT_FORCE].is_clear_all()) + { + tbl->force_index_group= TRUE; + index_group[INDEX_HINT_USE].merge(index_group[INDEX_HINT_FORCE]); + } + + /* + TODO: get rid of tbl->force_index (on if any FORCE INDEX is specified) and + create tbl->force_index_join instead. + Then use the correct force_index_XX instead of the global one. + */ if (!index_join[INDEX_HINT_FORCE].is_clear_all() || - !index_order[INDEX_HINT_FORCE].is_clear_all() || - !index_group[INDEX_HINT_FORCE].is_clear_all()) + tbl->force_index_group || tbl->force_index_order) { tbl->force_index= TRUE; index_join[INDEX_HINT_USE].merge(index_join[INDEX_HINT_FORCE]); - index_order[INDEX_HINT_USE].merge(index_order[INDEX_HINT_FORCE]); - index_group[INDEX_HINT_USE].merge(index_group[INDEX_HINT_FORCE]); } /* apply USE INDEX */ |