[MDEV-3913] Wrong result (NULLs instead of real values, missing rows) with semijoin+materialization, LEFT JOIN, key, IN subquery, Aria Created: 2012-12-03 Updated: 2013-02-25 Resolved: 2013-02-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.0, 5.5.28, 5.3.10 |
| Fix Version/s: | 10.0.2, 5.5.30, 5.3.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | optimizer | ||
| Issue Links: |
|
||||
| Description |
|
The following test case
produces one row with NULLs instead of t1.* values:
The expected result is 2 rows without NULLs:
Also reproducible on older versions of 5.3 (I checked down to 5.3.4). Reproducible with minimal optimizer_switch materialization=on,semijoin=on as well as with the default optimizer_switch:
EXPLAIN with the minimal optimizer_switch (wrong result):
EXPLAIN with the default optimizer_switch (also wrong result):
|
| Comments |
| Comment by Timour Katchaounov (Inactive) [ 2013-01-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The wrong result is strictly specific to semi-join materialization. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Timour Katchaounov (Inactive) [ 2013-01-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The following simplified test case compares the query plans chosen when MyISAM and Aria are used. – Aria tables – MyISAM tables EXPLAIN SELECT * EXPLAIN SELECT * MariaDB [test]> EXPLAIN SELECT *
-----
----- MariaDB [test]>
-----
----- MariaDB [test]>
-----
----- MariaDB [test]>
-----
----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Timour Katchaounov (Inactive) [ 2013-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The following test with MyISAM tables demonstrates that the wrong result is not aria-specific, but it is a semi-join materialization bug: – MyISAM tables set @@join_cache_level=0; set @@optimizer_switch='semijoin=on'; SELECT * set @@optimizer_switch='semijoin=off'; SELECT * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2013-01-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Apparently this is a duplicate of mdev-3995 whose test case is much simpler though much bigger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Timour Katchaounov (Inactive) [ 2013-01-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am not sure this is a duplicate based on the following observations:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Timour Katchaounov (Inactive) [ 2013-01-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am not sure this is a duplicate based on the following observations:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2013-02-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The original bug was not a duplicate of bug mdev-3995. The original bug can be reproduced with MyISAM table with the following test case: CREATE TABLE t1 (a1 char(1), b1 char(1), index idx(b1,a1)); CREATE TABLE t2 (a2 char(1), b2 char(1)); CREATE TABLE t3 (a3 int); CREATE TABLE t4 (a4 char(1), b4 char(1)); set optimizer_switch='materialization=off'; EXPLAIN EXTENDED set optimizer_switch='materialization=on'; EXPLAIN EXTENDED DROP TABLE t1,t2,t3,t4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2013-02-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The fix for the bug was pushed into the 5.3 tree on 20-02-2013. |