[MDEV-3097] LP:675516 - wrong result with join_cache_level = 4, join_cache_hashed, join_cache_incremental, outer_join_with_cache Created: 2010-11-15  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: Igor Babaev
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug675516.xml    

 Description   

The following query

SELECT STRAIGHT_JOIN table1.f7 FROM G AS table1 LEFT JOIN E AS table2 RIGHT JOIN M AS table3 ON table2.f8 = table3.f8 JOIN G AS table4 ON table4.f8 ON table1.f6 = table2.f10 WHERE table2.f7 IS NULL ;

returns "7" when executed with (incremental, BNLH join), (flat, BNL join) and (incremental, BNL join) and no rows when executed with join_cache_level=0.

Test case:

--source include/have_innodb.inc

SET SESSION storage_engine='InnoDB';
SET SESSION join_cache_level = 4;
SET SESSION optimizer_switch = 'join_cache_hashed=on';
SET SESSION optimizer_switch = 'join_cache_incremental=on';
SET SESSION optimizer_switch = 'outer_join_with_cache=on';

DROP TABLE IF EXISTS M;
CREATE TABLE M (
f8 int) ;
INSERT IGNORE INTO M VALUES ('5');

DROP TABLE IF EXISTS G;
CREATE TABLE G (
f7 int,
f8 int,
f6 int) ;
INSERT IGNORE INTO G VALUES ('7','8','0');

DROP TABLE IF EXISTS E;
CREATE TABLE E (
f7 int,
f8 int,
f10 int,
PRIMARY KEY (f8)) ;
INSERT IGNORE INTO E VALUES ('2','5','0');

SELECT STRAIGHT_JOIN table1.f7 FROM G AS table1 LEFT JOIN E AS table2 RIGHT JOIN M AS table3 ON table2.f8 = table3.f8 JOIN G AS table4 ON table4.f8 ON table1.f6 = table2.f10 WHERE table2.f7 IS NULL ;
EXPLAIN SELECT STRAIGHT_JOIN table1.f7 FROM G AS table1 LEFT JOIN E AS table2 RIGHT JOIN M AS table3 ON table2.f8 = table3.f8 JOIN G AS table4 ON table4.f8 ON table1.f6 = table2.f10 WHERE table2.f7 IS NULL ;
SET SESSION join_cache_level=0;
SELECT STRAIGHT_JOIN table1.f7 FROM G AS table1 LEFT JOIN E AS table2 RIGHT JOIN M AS table3 ON table2.f8 = table3.f8 JOIN G AS table4 ON table4.f8 ON table1.f6 = table2.f10 WHERE table2.f7 IS NULL ;
EXPLAIN SELECT STRAIGHT_JOIN table1.f7 FROM G AS table1 LEFT JOIN E AS table2 RIGHT JOIN M AS table3 ON table2.f8 = table3.f8 JOIN G AS table4 ON table4.f8 ON table1.f6 = table2.f10 WHERE table2.f7 IS NULL ;



 Comments   
Comment by Philip Stoev (Inactive) [ 2010-11-15 ]

Re: wrong result with join_cache_level = 4, join_cache_hashed, join_cache_incremental, outer_join_with_cache
Issue is also reproducible with a 3-way join.

Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ]

Launchpad bug id: 675516

Generated at Thu Feb 08 06:46:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.