Wrong result with subquery semijoin materialization and outer join
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Sergey Petrunia |
Bug Description
The following query over the 'world' database incorrectly produces wrong result
of 1 row instead of an empty result:
create database world;
use world;
source mysql-test/
source mysql-test/
set @@optimizer_
MariaDB [world]> select * from CountryLanguage where (Language, Country) IN (SELECT City.Name, Country.Code FROM City LEFT JOIN Country ON (Country = Code and Code > 'LLL'));
+------
| Country | Language | Percentage |
+------
| KEN | Meru | 5.5 |
+------
1 row in set (0.22 sec)
set @@optimizer_
=> empty result;
Changed in maria: | |
status: | Fix Committed → Fix Released |
In addition, running the above query with semijoin materialization is twice slower
than with non-semijoin materialization.
set @@optimizer_ switch= 'materializatio n=on,semijoin= off';
MariaDB [world]> select * from CountryLanguage where (Language, Country) IN (SELECT City.Name, Country.Code FROM City LEFT JOIN Country ON (Country = Code and Code > 'LLL'));
Empty set (0.10 sec)
Notice 0.1 sec vs 0.22 sec, averaged over several executions.