Assertion `join->best_read < ((double)1.79..5e+308L)' failed in greedy_search with LEFT JOINs and unique keys
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Committed
|
High
|
Sergey Petrunia |
Bug Description
mysqld: sql_select.cc:5216: bool greedy_
#8 0xb7530014 in __assert_fail () from /lib/libc.so.6
#9 0x0831264d in greedy_search (join=0x93a0ac8, remaining_
at sql_select.cc:5216
#10 0x08312106 in choose_plan (join=0x93a0ac8, join_tables=19) at sql_select.cc:4923
#11 0x0830dde9 in make_join_
keyuse_
#12 0x08306da8 in JOIN::optimize (this=0x93a0ac8) at sql_select.cc:1034
#13 0x0830beff in mysql_select (thd=0x9315728, rref_pointer_
wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0,
select_
at sql_select.cc:2551
#14 0x08304e3a in handle_select (thd=0x9315728, lex=0x93169cc, result=0x938adf0,
setup_
#15 0x082ae487 in execute_
#16 0x082a58fa in mysql_execute_
#17 0x082b089b in mysql_parse (thd=0x9315728,
rawbuf=
#18 0x082a354c in dispatch_command (command=COM_QUERY, thd=0x9315728,
packet=
#19 0x082a27b7 in do_command (thd=0x9315728) at sql_parse.cc:906
#20 0x0829f7b3 in handle_
#21 0xb767bb25 in start_thread () from /lib/libpthread
maria-5.1:
bzr version-info
revision-id: <email address hidden>
date: 2012-04-24 17:29:03 +0200
revno: 3147
Also reproducible on maria-5.2 (revno 3149).
Could not reproduce on maria-5.3, maria-5.5, although possibly it requires custom optimizer switch.
Could not reproduce on mysql-trunk (revno 3827)/
EXPLAIN also fails.
minimal optimizer_switch: table_eliminati
full optimizer_switch (default): index_merge=
Test case:
SET optimizer_switch = 'table_
CREATE TABLE A (a1 INT);
CREATE TABLE B (b1 INT);
CREATE TABLE C (c1 INT, UNIQUE KEY(c1));
CREATE TABLE D (d1 INT, UNIQUE KEY(d1));
CREATE TABLE E (e1 INT);
INSERT INTO A VALUES (1),(2);
INSERT INTO B VALUES (2),(3);
INSERT INTO C VALUES (3),(4);
INSERT INTO D VALUES (4),(5);
INSERT INTO E VALUES (5),(6);
SELECT a1 FROM A LEFT JOIN B LEFT JOIN C LEFT JOIN D
ON c1 = d1 ON d1 = b1 ON a1 = b1
LEFT JOIN E ON a1 = e1 ;
# End of test case
Changed in maria: | |
assignee: | Igor Babaev (igorb-seattle) → Sergey Petrunia (sergefp) |
Changed in maria: | |
status: | New → Confirmed |
status: | Confirmed → In Progress |
Tables D and C are eliminated.
Remaining tables are: { A B E}
Optimization considers a join prefix of {A, B} path(<E> ) is never called, ing_with_ nj() doesn't allow to put it into the join embedding_ map!=0.
best_access_
because check_interleav
order,
because join->cur_
This is so, because we've "entered" a join nest for table B and have never left it.
Will need to check why it works in 5.3