Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 5.3.12
-
Fix Version/s: None
-
Component/s: None
-
Labels:
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/include/world_schema.inc
source mysql-test/include/world.inc
set @@optimizer_switch='materialization=on,semijoin=on';
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_switch='materialization=on,semijoin=off';
=> empty result;
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Wrong result with subquery semijoin materialization and outer join
In addition, running the above query with semijoin materialization is twice slower
than with non-semijoin materialization.
set @@optimizer_switch='materialization=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.