From: Date: September 27 2006 12:11pm Subject: bk commit into 5.1 tree (gkodinov:1.2338) BUG#21174 List-Archive: http://lists.mysql.com/commits/12597 X-Bug: 21174 Message-Id: <20060927101126.4DCCD5AE451@macbook.gmz> Below is the list of changes that have just been committed into a local 5.1 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-09-27 13:11:00+03:00, gkodinov@stripped +3 -0 Bug#21174: Index degrades sort performance and optimizer does not honor IGNORE INDEX - fix moved to 5.1 mysql-test/r/group_by.result@stripped, 2006-09-27 13:10:48+03:00, gkodinov@stripped +9 -0 Bug#21174: Index degrades sort performance and optimizer does not honor IGNORE INDEX - fix moved to 5.1 mysql-test/t/group_by.test@stripped, 2006-09-27 13:10:49+03:00, gkodinov@stripped +12 -0 Bug#21174: Index degrades sort performance and optimizer does not honor IGNORE INDEX - fix moved to 5.1 sql/sql_select.cc@stripped, 2006-09-27 13:10:50+03:00, gkodinov@stripped +2 -0 Bug#21174: Index degrades sort performance and optimizer does not honor IGNORE INDEX - fix moved to 5.1 # 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.1-opt --- 1.442/sql/sql_select.cc 2006-09-27 13:11:25 +03:00 +++ 1.443/sql/sql_select.cc 2006-09-27 13:11:25 +03:00 @@ -11875,6 +11875,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.73/mysql-test/r/group_by.result 2006-09-27 13:11:25 +03:00 +++ 1.74/mysql-test/r/group_by.result 2006-09-27 13:11:25 +03:00 @@ -821,3 +821,12 @@ a b real_b 68 France France DROP VIEW v1; DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4); +EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 4 +EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +DROP TABLE t1; --- 1.59/mysql-test/t/group_by.test 2006-09-27 13:11:25 +03:00 +++ 1.60/mysql-test/t/group_by.test 2006-09-27 13:11:25 +03:00 @@ -655,3 +655,15 @@ where t2.b=v1.a GROUP BY t2.b; DROP VIEW v1; DROP TABLE t1,t2; + +# +# Bug #21174: Index degrades sort performance and +# optimizer does not honor IGNORE INDEX +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4); + +EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2; +EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2; + +DROP TABLE t1;