Skip to content

Commit 6df9b64

Browse files
committed
Bug#34196318 ndb_subquery failing
Bug#28856115 NDB.NDB_SUBQUERY FAILS IN SOLARIS/SPARC Problem: -------- The ndb_subquery test failed sporadically on Solaris platforms. This was due to a slightly different query plan. Fix: ---- Use an optimizer hint in the subquery to use the duplicate weedout strategy. Change-Id: Ied3821d16ad2f47c90da50e7df7cab46fea4eeb7
1 parent e2b61c0 commit 6df9b64

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

mysql-test/suite/ndb/r/ndb_subquery.result

+7-12
Original file line numberDiff line numberDiff line change
@@ -156,33 +156,28 @@ INSERT INTO `v` VALUES
156156
('on',NULL,'say',33,23,'about','izjphzzxquxwwrxan','I\'ll',7,'2009-02-10 20:02:17','2005-03-05 21:18:45','are','my',4,'lizjphzzxq','out'),
157157
('just',NULL,'with',22,8,'rmap','something','something',4,NULL,'2006-01-14 09:08:21','or','mean',31,'frmapuikkd','here'),
158158
('who','2000-07-21 09:51:12','or',28,10,'fcnuiisfrmapuikk','for','me',13,'2001-03-20 15:30:14','2003-09-12 10:09:54','is','qfcn',3,'when','well');
159-
analyze table i,v;
160-
Table Op Msg_type Msg_text
161-
test.i analyze status OK
162-
test.v analyze status OK
163159
set ndb_join_pushdown = off;
164-
set optimizer_switch= 'firstmatch=off';
165-
set optimizer_switch= 'materialization=off';
166160
explain
167161
SELECT pk, col_int_key
168162
FROM v AS table1
169-
WHERE table1.col_int_key IN (SELECT col_int_key AS field2 FROM i as table1s)
163+
WHERE table1.col_int_key IN (
164+
SELECT /*+ SEMIJOIN(DUPSWEEDOUT) */ col_int_key AS field2 FROM i as table1s)
170165
;
171166
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
172-
1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 ALL col_int_key NULL NULL NULL 15 100.00 Using where with pushed condition (`test`.`table1`.`col_int_key` is not null)
173-
1 SIMPLE table1s p0,p1,p2,p3,p4,p5,p6,p7 ref col_int_key col_int_key 5 test.table1.col_int_key 1 100.00 Start temporary; End temporary
167+
1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 ALL col_int_key NULL NULL NULL ### 100.00 Using where with pushed condition (`test`.`table1`.`col_int_key` is not null)
168+
1 SIMPLE table1s p0,p1,p2,p3,p4,p5,p6,p7 ref col_int_key col_int_key 5 test.table1.col_int_key ### 100.00 Start temporary; End temporary
174169
Warnings:
175-
Note 1003 /* select#1 */ select `test`.`table1`.`pk` AS `pk`,`test`.`table1`.`col_int_key` AS `col_int_key` from `test`.`v` `table1` semi join (`test`.`i` `table1s`) where (`test`.`table1s`.`col_int_key` = `test`.`table1`.`col_int_key`)
170+
Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` DUPSWEEDOUT) */ `test`.`table1`.`pk` AS `pk`,`test`.`table1`.`col_int_key` AS `col_int_key` from `test`.`v` `table1` semi join (`test`.`i` `table1s`) where (`test`.`table1s`.`col_int_key` = `test`.`table1`.`col_int_key`)
176171
SELECT pk, col_int_key
177172
FROM v AS table1
178-
WHERE table1.col_int_key IN (SELECT col_int_key AS field2 FROM i as table1s)
173+
WHERE table1.col_int_key IN (
174+
SELECT /*+ SEMIJOIN(DUPSWEEDOUT) */ col_int_key AS field2 FROM i as table1s)
179175
;
180176
pk col_int_key
181177
10 3
182178
17 6
183179
20 13
184180
23 4
185181
24 13
186-
set optimizer_switch= default;
187182
DROP TABLE IF EXISTS i,v;
188183
End of 5.6 tests

mysql-test/suite/ndb/t/ndb_subquery.test

+5-9
Original file line numberDiff line numberDiff line change
@@ -156,26 +156,22 @@ INSERT INTO `v` VALUES
156156
('just',NULL,'with',22,8,'rmap','something','something',4,NULL,'2006-01-14 09:08:21','or','mean',31,'frmapuikkd','here'),
157157
('who','2000-07-21 09:51:12','or',28,10,'fcnuiisfrmapuikk','for','me',13,'2001-03-20 15:30:14','2003-09-12 10:09:54','is','qfcn',3,'when','well');
158158

159-
analyze table i,v;
160-
161-
#encourage usage of duplicate weedout algorithm:
162159
set ndb_join_pushdown = off;
163-
set optimizer_switch= 'firstmatch=off';
164-
set optimizer_switch= 'materialization=off';
165160

161+
--replace_column 10 ###
166162
explain
167163
SELECT pk, col_int_key
168164
FROM v AS table1
169-
WHERE table1.col_int_key IN (SELECT col_int_key AS field2 FROM i as table1s)
165+
WHERE table1.col_int_key IN (
166+
SELECT /*+ SEMIJOIN(DUPSWEEDOUT) */ col_int_key AS field2 FROM i as table1s)
170167
;
171168
--sorted_result
172169
SELECT pk, col_int_key
173170
FROM v AS table1
174-
WHERE table1.col_int_key IN (SELECT col_int_key AS field2 FROM i as table1s)
171+
WHERE table1.col_int_key IN (
172+
SELECT /*+ SEMIJOIN(DUPSWEEDOUT) */ col_int_key AS field2 FROM i as table1s)
175173
;
176174

177-
set optimizer_switch= default;
178-
179175
DROP TABLE IF EXISTS i,v;
180176

181177
--echo End of 5.6 tests

0 commit comments

Comments
 (0)