summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/analyze_stmt_orderby.result26
-rw-r--r--mysql-test/t/analyze_stmt_orderby.test25
2 files changed, 49 insertions, 2 deletions
diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result
index be1f01a2a52..643c0318f95 100644
--- a/mysql-test/r/analyze_stmt_orderby.result
+++ b/mysql-test/r/analyze_stmt_orderby.result
@@ -583,4 +583,28 @@ ANALYZE
}
}
drop table t2;
-drop table t0,t1;
+drop table t1;
+#
+# MDEV-9504: ANALYZE TABLE shows wrong 'rows' value for ORDER BY query
+#
+create table t1 (
+a int,
+filler1 char(128),
+filler2 char(128),
+key(a)
+);
+insert into t1
+select A.a+10*B.a+100*C.a, repeat('abc-',32), repeat('abc-',32)
+from t0 A, t0 B, t0 C;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+explain select a from t1 order by a limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 5 NULL 10 Using index
+# 'rows' in ANALYZE output must match 'rows' in EXPLAIN:
+analyze select a from t1 order by a limit 10;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 index NULL a 5 NULL 10 10.00 100.00 100.00 Using index
+drop table t1;
+drop table t0;
diff --git a/mysql-test/t/analyze_stmt_orderby.test b/mysql-test/t/analyze_stmt_orderby.test
index a40f34805d1..dc63fcaa285 100644
--- a/mysql-test/t/analyze_stmt_orderby.test
+++ b/mysql-test/t/analyze_stmt_orderby.test
@@ -174,4 +174,27 @@ select col1 f1, col2 f2, col1 f3 from t2 group by f1;
drop table t2;
-drop table t0,t1;
+drop table t1;
+
+--echo #
+--echo # MDEV-9504: ANALYZE TABLE shows wrong 'rows' value for ORDER BY query
+--echo #
+create table t1 (
+ a int,
+ filler1 char(128),
+ filler2 char(128),
+ key(a)
+);
+
+insert into t1
+select A.a+10*B.a+100*C.a, repeat('abc-',32), repeat('abc-',32)
+from t0 A, t0 B, t0 C;
+analyze table t1;
+
+explain select a from t1 order by a limit 10;
+--echo # 'rows' in ANALYZE output must match 'rows' in EXPLAIN:
+analyze select a from t1 order by a limit 10;
+
+drop table t1;
+drop table t0;
+