[MDEV-2237] LP:869001 - Wrong result with semijoin + materialization + firstmatch + multipart key Created: 2011-10-06 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip Stoev (Inactive) | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query: SELECT * returns 1 row when executed with materialization=on,semijoin=on,firstmatch=on: -----
-----
----- even though it should return 2 rows: -----
-----
----- explain:
---
minimal switch: test case: SET SESSION optimizer_switch='materialization=on,semijoin=on,firstmatch=on'; CREATE TABLE t1 ( f2 int, f3 varchar(1), KEY (f3,f2)) ; CREATE TABLE t2 ( f4 varchar(1)) ; CREATE TABLE t3 ( f1 int) ; CREATE TABLE t4 ( f3 varchar(1)) ; SELECT * revision-id: <email address hidden> |
| Comments |
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key revno: 3200 and debug build. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key revno: 3216 [merge] (I did take into account the @@optimizer_switch default value change and set all the flags). | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key revno: 3216 [merge] and debug build. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key
---
--- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key set join_cache_level=0 then I get an EXPLAIN that's much closer MariaDB [bug869001]> explain SELECT * FROM t1 JOIN t2 ON (t2.f4 = t1.f3 ) WHERE ( 8 ) IN ( SELECT t3.f1 FROM t3 , t4 );
---
--- but it's still different from the plan in the bug report because in this plan t2 has type=system, while there t2 has type=ALL. It is interesting that in bug report t2 has type=ALL, rows=1. 1-row MyISAM tables become system tables. did the original report use InnODB? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key MariaDB [bug869001]> explain SELECT * FROM t1 JOIN t2 ON (t2.f4 = t1.f3 ) WHERE ( 8 ) IN ( SELECT t3.f1 FROM t3 , t4 );
---
--- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key
-----
----- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Wrong result with semijoin + materialization + firstmatch + multipart key | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 869001 |