diff options
author | unknown <sergefp@mysql.com> | 2004-05-29 17:50:05 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-05-29 17:50:05 +0400 |
commit | 2164db3c8c4c086dcc16d73baf7557a344d82129 (patch) | |
tree | 0091eca0060a62efd981e070aa6e5280c24378cd | |
parent | 1ce1880204149404e09411505d457c452a29d55b (diff) | |
download | mariadb-git-2164db3c8c4c086dcc16d73baf7557a344d82129.tar.gz |
* Undo of range optimizer fix from previous changeset
* Fixed test results.
mysql-test/r/index_merge_ror.result:
Typo fix
mysql-test/r/rowid_order_bdb.result:
new index_merge EXPLAIN output format changes
mysql-test/r/rowid_order_innodb.result:
new index_merge EXPLAIN output format changes
sql/opt_range.cc:
Undo of previous fix:
If cost(full_scan_on_covering_index) < cost(best_range_scan) < cost(full_table_scan)
use full_scan_on_covering_index, not best_range_scan.
The fix affects read plan choice for more queries then initially anticipated, so I'm reverting it for now, will get back to this later
-rw-r--r-- | mysql-test/r/index_merge_ror.result | 1 | ||||
-rw-r--r-- | mysql-test/r/rowid_order_bdb.result | 2 | ||||
-rw-r--r-- | mysql-test/r/rowid_order_innodb.result | 2 | ||||
-rw-r--r-- | sql/opt_range.cc | 24 |
4 files changed, 16 insertions, 13 deletions
diff --git a/mysql-test/r/index_merge_ror.result b/mysql-test/r/index_merge_ror.result index 3049f2857f0..15ad1026ca0 100644 --- a/mysql-test/r/index_merge_ror.result +++ b/mysql-test/r/index_merge_ror.result @@ -193,3 +193,4 @@ insert into t2 values ('ab', 'ab', 'uh', 'oh'); explain select a from t2 where a='ab'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref a a 6 const 1 Using where +drop table t2; diff --git a/mysql-test/r/rowid_order_bdb.result b/mysql-test/r/rowid_order_bdb.result index 8f385dfc75f..bbdc6f6ff77 100644 --- a/mysql-test/r/rowid_order_bdb.result +++ b/mysql-test/r/rowid_order_bdb.result @@ -14,7 +14,7 @@ insert into t1 values (-5, 1, 1), (10, 1, 1); explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using where +1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; pk1 key1 key2 -100 1 1 diff --git a/mysql-test/r/rowid_order_innodb.result b/mysql-test/r/rowid_order_innodb.result index 60d237a977c..c56eb1a5cde 100644 --- a/mysql-test/r/rowid_order_innodb.result +++ b/mysql-test/r/rowid_order_innodb.result @@ -14,7 +14,7 @@ insert into t1 values (-5, 1, 1), (10, 1, 1); explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 6 Using where +1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 6 Using sort_union(key1,key2); Using where select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; pk1 key1 key2 -100 1 1 diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ee328dadad6..59ded7354f1 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1610,17 +1610,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, } param.key_parts_end=key_parts; - /* Calculate cost of full index read for the shortest covering index */ - if (!head->used_keys.is_clear_all()) - { - int key_for_use= find_shortest_key(head, &head->used_keys); - double key_read_time= get_index_only_read_time(¶m, records, - key_for_use); - DBUG_PRINT("info", ("'all'+'using index' scan will be using key %d, " - "read time %g", key_for_use, key_read_time)); - if (key_read_time < read_time) - read_time= key_read_time; - } if ((tree=get_mm_tree(¶m,cond))) { @@ -1683,6 +1672,19 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, SEL_IMERGE *imerge; TABLE_READ_PLAN *best_conj_trp= NULL, *new_conj_trp; LINT_INIT(new_conj_trp); /* no empty index_merge lists possible */ + + /* Calculate cost of full index read for the shortest covering index */ + if (!head->used_keys.is_clear_all()) + { + int key_for_use= find_shortest_key(head, &head->used_keys); + double key_read_time= get_index_only_read_time(¶m, records, + key_for_use); + DBUG_PRINT("info", ("'all'+'using index' scan will be using key %d, " + "read time %g", key_for_use, key_read_time)); + if (key_read_time < read_time) + read_time= key_read_time; + } + DBUG_PRINT("info",("No range reads possible," " trying to construct index_merge")); List_iterator_fast<SEL_IMERGE> it(tree->merges); |