We're updating the issue view to help you get more done.Learn more

Server crashes in select_describe on EXPLAIN with materialization+semijoin, 2 nested subqueries, aggregate functions

Note: It might belong to Timour, because the problem appeared with revno 3445 ( MDEV-193 ), but since it requires semijoin, assigning to Sergei for starters. Please re-assign if needed.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #3 <signal handler called> #4 0x000000000067097e in select_describe (join=0x3acd4b8, need_tmp_table=false, need_order=false, distinct=false, message=0x0) at sql/sql_select.cc:21369 #5 0x0000000000641e5b in JOIN::exec (this=0x3acd4b8) at sql/sql_select.cc:2336 #6 0x0000000000644581 in mysql_select (thd=0x39ab110, rref_pointer_array=0x3aef0a0, tables=0x3aefb18, wild_num=0, fields=..., conds=0x3ad3e08, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x3acc458, unit=0x3aef190, select_lex=0x3aeee48) at sql/sql_select.cc:3044 #7 0x0000000000672e7c in mysql_explain_union (thd=0x39ab110, unit=0x3aef190, result=0x3acc458) at sql/sql_select.cc:21914 #8 0x0000000000672b93 in select_describe (join=0x3accd38, need_tmp_table=false, need_order=false, distinct=false, message=0x0) at sql/sql_select.cc:21871 #9 0x0000000000641e5b in JOIN::exec (this=0x3accd38) at sql/sql_select.cc:2336 #10 0x0000000000644581 in mysql_select (thd=0x39ab110, rref_pointer_array=0x39addc8, tables=0x3aee760, wild_num=1, fields=..., conds=0x3acc2a8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x3acc458, unit=0x39ad498, select_lex=0x39adb70) at sql/sql_select.cc:3044 #11 0x0000000000672e7c in mysql_explain_union (thd=0x39ab110, unit=0x39ad498, result=0x3acc458) at sql/sql_select.cc:21914 #12 0x0000000000614255 in execute_sqlcom_select (thd=0x39ab110, all_tables=0x3aee760) at sql/sql_parse.cc:4592 #13 0x000000000060cf7e in mysql_execute_command (thd=0x39ab110) at sql/sql_parse.cc:2189 #14 0x0000000000616ca1 in mysql_parse (thd=0x39ab110, rawbuf=0x3aee4c8 "EXPLAIN \nSELECT * FROM t1 WHERE a = ( \nSELECT MAX(b) FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) \n) OR a = 10", length=110, parser_state=0x7f3e9988b500) at sql/sql_parse.cc:5736 #15 0x000000000060a517 in dispatch_command (command=COM_QUERY, thd=0x39ab110, packet=0x3aa6141 "", packet_length=110) at sql/sql_parse.cc:1055 #16 0x00000000006097ce in do_command (thd=0x39ab110) at sql/sql_parse.cc:794 #17 0x000000000070ac27 in do_handle_one_connection (thd_arg=0x39ab110) at sql/sql_connect.cc:1253 #18 0x000000000070a612 in handle_one_connection (arg=0x39ab110) at sql/sql_connect.cc:1168 #19 0x0000000000c015ef in pfs_spawn_thread (arg=0x3b2ea30) at storage/perfschema/pfs.cc:1015 #20 0x00007f3ea4ee8efc in start_thread (arg=0x7f3e9988c700) at pthread_create.c:304 #21 0x00007f3ea425b59d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

bzr version-info

1 2 3 4 5 revision-id: psergey@askmonty.org-20120725164148-cylxnymo9d37kae7 date: 2012-07-25 20:41:48 +0400 build-date: 2012-08-03 23:38:22 +0400 revno: 3473 branch-nick: maria-5.5

Also reproducible on revno 3445. Not reproducible on revno 3444.
Reproducible with MyISAM, Aria, InnoDB.

Minimal optimizer_switch:
materialization=on,semijoin=on

Default optimizer_switch:

1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off

Test case:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SET optimizer_switch = 'materialization=on,semijoin=on'; CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM; INSERT INTO t1 VALUES (8),(0); CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM; INSERT INTO t2 VALUES (4,'j'),(6,'v'); CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM; INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = ( SELECT MAX(b) FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ) OR a = 10;

Status

Assignee

Sergei Petrunia

Reporter

Elena Stepanova

Fix versions

Affects versions

5.5.25

Priority

Critical