Skip to content

Commit 3e49b6e

Browse files
committed
Bug #20987670 : sporadic test failure in subquery_mat_all subquery_mat and subquery_mat_none.
ISSUE: ------ After ALTER TABLE test case has called EXPLAIN query. But since ANALYZE was not called and stats were not updated, EXPLAINs results started varying for different runs. Hence sporadic failures. FIX: ---- Add ANALYZE TABLE before EXPLAIN query.
1 parent b587f74 commit 3e49b6e

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

mysql-test/include/subquery_mat.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,8 @@ eval $query;
14571457
ALTER TABLE t1 MODIFY a VARCHAR(332) CHARACTER SET UTF8;
14581458
--enable_warnings
14591459

1460+
ANALYZE TABLE t1;
1461+
14601462
# Now subquery materialization can be used, and result is still correct:
14611463
eval EXPLAIN $query;
14621464
eval $query;

mysql-test/r/subquery_mat.result

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,14 +1899,17 @@ SELECT t2.a FROM t1 as t2
18991899
COUNT(*)
19001900
0
19011901
ALTER TABLE t1 MODIFY a VARCHAR(332) CHARACTER SET UTF8;
1902+
ANALYZE TABLE t1;
1903+
Table Op Msg_type Msg_text
1904+
test.t1 analyze status OK
19021905
EXPLAIN SELECT COUNT(*)
19031906
FROM t1
19041907
WHERE t1.a NOT IN (
19051908
SELECT t2.a FROM t1 as t2
19061909
);
19071910
id select_type table type possible_keys key key_len ref rows Extra
1908-
1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where
1909-
2 SUBQUERY t2 ALL NULL NULL NULL NULL 1 NULL
1911+
1 PRIMARY t1 ALL NULL NULL NULL NULL 32 Using where
1912+
2 SUBQUERY t2 ALL NULL NULL NULL NULL 32 NULL
19101913
SELECT COUNT(*)
19111914
FROM t1
19121915
WHERE t1.a NOT IN (

mysql-test/r/subquery_mat_all.result

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,14 +1912,17 @@ SELECT t2.a FROM t1 as t2
19121912
COUNT(*)
19131913
0
19141914
ALTER TABLE t1 MODIFY a VARCHAR(332) CHARACTER SET UTF8;
1915+
ANALYZE TABLE t1;
1916+
Table Op Msg_type Msg_text
1917+
test.t1 analyze status OK
19151918
EXPLAIN SELECT COUNT(*)
19161919
FROM t1
19171920
WHERE t1.a NOT IN (
19181921
SELECT t2.a FROM t1 as t2
19191922
);
19201923
id select_type table type possible_keys key key_len ref rows Extra
1921-
1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where
1922-
2 SUBQUERY t2 ALL NULL NULL NULL NULL 1 NULL
1924+
1 PRIMARY t1 ALL NULL NULL NULL NULL 32 Using where
1925+
2 SUBQUERY t2 ALL NULL NULL NULL NULL 32 NULL
19231926
SELECT COUNT(*)
19241927
FROM t1
19251928
WHERE t1.a NOT IN (

mysql-test/r/subquery_mat_none.result

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,14 +1898,17 @@ SELECT t2.a FROM t1 as t2
18981898
COUNT(*)
18991899
0
19001900
ALTER TABLE t1 MODIFY a VARCHAR(332) CHARACTER SET UTF8;
1901+
ANALYZE TABLE t1;
1902+
Table Op Msg_type Msg_text
1903+
test.t1 analyze status OK
19011904
EXPLAIN SELECT COUNT(*)
19021905
FROM t1
19031906
WHERE t1.a NOT IN (
19041907
SELECT t2.a FROM t1 as t2
19051908
);
19061909
id select_type table type possible_keys key key_len ref rows Extra
1907-
1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where
1908-
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 Using where
1910+
1 PRIMARY t1 ALL NULL NULL NULL NULL 32 Using where
1911+
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 32 Using where
19091912
SELECT COUNT(*)
19101913
FROM t1
19111914
WHERE t1.a NOT IN (

0 commit comments

Comments
 (0)