summaryrefslogtreecommitdiff
path: root/mysql-test/r/key.result
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-03-20 23:27:08 +0100
committerSergei Golubchik <sergii@pisem.net>2014-03-20 23:27:08 +0100
commit3bb249612fe3864f152aa990d4d5f267ac9bb688 (patch)
tree4d3c2f0d1b2d4334ed098bf4d7955570045d065e /mysql-test/r/key.result
parentdee0fd42334f9ec03dd761d9fabbdecedcb31528 (diff)
downloadmariadb-git-3bb249612fe3864f152aa990d4d5f267ac9bb688.tar.gz
MDEV-5846 MySQL Bug #18144 - Cost with FORCE/USE index seems incorrect in some cases.
Diffstat (limited to 'mysql-test/r/key.result')
-rw-r--r--mysql-test/r/key.result27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 2479308a2c4..a89a79dadbb 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -612,3 +612,30 @@ SELECT 1 as RES FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
RES
DROP TABLE t1;
+#
+# Bug#18144: Cost with FORCE/USE index seems incorrect in some cases.
+#
+# We are interested in showing that the cost for the last plan is higher
+# than for the preceding two plans.
+#
+CREATE TABLE t1( a INT, b INT, KEY( a ) );
+INSERT INTO t1 values (1, 2), (1, 3), (2, 3), (2, 4), (3, 4), (3, 5);
+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 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+SHOW STATUS LIKE 'Last_query_cost';
+Variable_name Value
+Last_query_cost 9.212184
+EXPLAIN SELECT a, SUM( b ) FROM t1 USE 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 6 Using temporary; Using filesort
+SHOW STATUS LIKE 'Last_query_cost';
+Variable_name Value
+Last_query_cost 9.212184
+EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 6
+SHOW STATUS LIKE 'Last_query_cost';
+Variable_name Value
+Last_query_cost 14.199000
+DROP TABLE t1;