Loading mysql-test/r/group_by.result +9 −0 Original line number Diff line number Diff line Loading @@ -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; mysql-test/t/group_by.test +12 −0 Original line number Diff line number Diff line Loading @@ -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; sql/sql_select.cc +2 −0 Original line number Diff line number Diff line Loading @@ -11875,6 +11875,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, 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) { Loading Loading
mysql-test/r/group_by.result +9 −0 Original line number Diff line number Diff line Loading @@ -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;
mysql-test/t/group_by.test +12 −0 Original line number Diff line number Diff line Loading @@ -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;
sql/sql_select.cc +2 −0 Original line number Diff line number Diff line Loading @@ -11875,6 +11875,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, 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) { Loading