Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-08-02 17:18:00+03:00, gkodinov@stripped +3 -0
Bug #21174: Index degrades sort performance and
optimizer does not honor IGNORE INDEX
- Allow an index to be used for sorting the table
instead of filesort only if it is not disabled by
IGNORE INDEX.
mysql-test/r/innodb_mysql.result@stripped, 2006-08-02 17:17:53+03:00, gkodinov@stripped +9
-0
Bug #21174: Index degrades sort performance and
optimizer does not honor IGNORE INDEX
- test case.
mysql-test/t/innodb_mysql.test@stripped, 2006-08-02 17:17:55+03:00, gkodinov@stripped +12
-0
Bug #21174: Index degrades sort performance and
optimizer does not honor IGNORE INDEX
- test case. Note it must be over an InnoDB table as
MyISAM tables don't support using only the index
for scanning the table and not going to the row. i.e.
keys_to_use_for_scanning() returns empty set for MyISAM.
sql/sql_select.cc@stripped, 2006-08-02 17:17:55+03:00, gkodinov@stripped +2 -0
Bug #21174: Index degrades sort performance and
optimizer does not honor IGNORE INDEX
- Allow an index to be used for sorting the table
instead of filesort only if it is not disabled by
IGNORE INDEX.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gkodinov
# Host: macbook.gmz
# Root: /Users/kgeorge/mysql/work/B21174-5.0-opt
--- 1.442/sql/sql_select.cc 2006-08-02 17:18:16 +03:00
+++ 1.443/sql/sql_select.cc 2006-08-02 17:18:16 +03:00
@@ -11498,6 +11498,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
We must not try to use disabled keys.
*/
usable_keys= table->s->keys_in_use;
+ /* we must not consider keys that are disabled by IGNORE INDEX */
+ usable_keys.intersect(table->keys_in_use_for_query);
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
{
--- 1.6/mysql-test/r/innodb_mysql.result 2006-08-02 17:18:16 +03:00
+++ 1.7/mysql-test/r/innodb_mysql.result 2006-08-02 17:18:16 +03:00
@@ -297,3 +297,12 @@ explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
drop table t1;
+CREATE TABLE t1 (a INT, b INT, KEY(a)) ENGINE = INNODB;
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 2
+EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+DROP TABLE t1;
--- 1.6/mysql-test/t/innodb_mysql.test 2006-08-02 17:18:16 +03:00
+++ 1.7/mysql-test/t/innodb_mysql.test 2006-08-02 17:18:16 +03:00
@@ -255,3 +255,15 @@ explain select distinct f1 a, f1 b from
explain select distinct f1, f2 from t1;
drop table t1;
+#
+# Bug #21174: Index degrades sort performance and
+# optimizer does not honor IGNORE INDEX
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a)) ENGINE = INNODB;
+
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+
+EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a ;
+EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a;
+
+DROP TABLE t1;
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2227) BUG#21174 | kgeorge | 2 Aug |