summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-10-19 17:17:08 +0400
committerAlexander Nozdrin <alik@sun.com>2009-10-19 17:17:08 +0400
commit3251065aef83d6cc8088b03e56f6f3242786de66 (patch)
tree18863557a9b43b168f930debb4fdcc69a37f4e82 /sql/table.cc
parent9b4b453ab8a5f7c7fa06b4ef22b6a10867fac187 (diff)
parentbf14598c9903067474a7cdf1c49bca9f52d0c55a (diff)
downloadmariadb-git-3251065aef83d6cc8088b03e56f6f3242786de66.tar.gz
Merge from mysql-5.1.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 9b27e1f8016..45099c1a4fb 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 */