[MDEV-3475] LP:623315 - Query returns less rows when run with join_cache_level=6 on maria-5.3-dsmrr-cpk Created: 2010-08-24  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: XML File LPexportBug623315.xml    

 Description   

The following query:

SELECT table2 .`pk`
FROM CC
LEFT JOIN CC table2
JOIN CC table3 ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
ON table3 .`col_int_nokey` ;

Returns 469 rows when executed with join_cache_level=6 on maria-5.3-dsmrr-cpk . maria-5.3 , join_cache_level=0 and using IGNORE INDEX to modify the query plan all agree that the query should return 480 rows.



 Comments   
Comment by Philip Stoev (Inactive) [ 2010-08-24 ]

Re: Query returns less rows when run with join_cache_level=6 on maria-5.3-dsmrr-cpk
Test case:

--source include/have_innodb.inc

CREATE TABLE `CC` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`col_int_nokey` int(11) DEFAULT NULL,
`col_int_key` int(11) DEFAULT NULL,
`col_varchar_key` varchar(1) DEFAULT NULL,
PRIMARY KEY (`pk`),
KEY `col_int_key` (`col_int_key`),
KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
INSERT INTO `CC` VALUES (10,7,8,'v');
INSERT INTO `CC` VALUES (11,1,9,'r');
INSERT INTO `CC` VALUES (12,5,9,'a');
INSERT INTO `CC` VALUES (13,3,186,'m');
INSERT INTO `CC` VALUES (14,6,NULL,'y');
INSERT INTO `CC` VALUES (15,92,2,'j');
INSERT INTO `CC` VALUES (16,7,3,'d');
INSERT INTO `CC` VALUES (17,NULL,0,'z');
INSERT INTO `CC` VALUES (18,3,133,'e');
INSERT INTO `CC` VALUES (19,5,1,'h');
INSERT INTO `CC` VALUES (20,1,8,'b');
INSERT INTO `CC` VALUES (21,2,5,'s');
INSERT INTO `CC` VALUES (22,NULL,5,'e');
INSERT INTO `CC` VALUES (23,1,8,'j');
INSERT INTO `CC` VALUES (24,0,6,'e');
INSERT INTO `CC` VALUES (25,210,51,'f');
INSERT INTO `CC` VALUES (26,8,4,'v');
INSERT INTO `CC` VALUES (27,7,7,'x');
INSERT INTO `CC` VALUES (28,5,6,'m');
INSERT INTO `CC` VALUES (29,NULL,4,'c');

SET SESSION join_optimizer_level=6;

SELECT table2 .`pk`
FROM CC LEFT JOIN CC table2 JOIN CC table3 ON table3 .`col_varchar_key` = table2 .`col_varchar_key` ON table3 .`col_int_nokey` ;

SET SESSION join_optimizer_level=0;

SELECT table2 .`pk`
FROM CC LEFT JOIN CC table2 JOIN CC table3 ON table3 .`col_varchar_key` = table2 .`col_varchar_key` ON table3 .`col_int_nokey` ;

Comment by Sergei Petrunia [ 2010-09-16 ]

Re: Query returns less rows when run with join_cache_level=6 on maria-5.3-dsmrr-cpk
Not repeatable after the most recent fixes.

Tip changeset I've tried with:
revno: 2831
committer: Sergey Petrunya <psergey@askmonty.org>
branch nick: maria-5.3-dsmrr-cpk-r5
timestamp: Wed 2010-09-15 20:58:38 +0400
message:
BUG#623300: Query with join_cache_level = 6 returns extra rows in maria-5.3-dsmrr-cpk

  • First part of the fix: enable Early NULLs filtering to work when WHERE clause is present
Comment by Arjen Lentz (Inactive) [ 2010-09-17 ]

Re: [Bug 623315] Re: Query returns less rows when run with join_cache_level=6 on maria-5.3-dsmrr-cpk
Hi Philip, Sergey

On 16/09/2010, at 5:31 PM, Sergey Petrunia wrote:
> Not repeatable after the most recent fixes.
>
> Tip changeset I've tried with:
> revno: 2831
> committer: Sergey Petrunya <psergey@askmonty.org>
> branch nick: maria-5.3-dsmrr-cpk-r5
> timestamp: Wed 2010-09-15 20:58:38 +0400
> message:
> BUG#623300: Query with join_cache_level = 6 returns extra rows in
> maria-5.3-dsmrr-cpk
> - First part of the fix: enable Early NULLs filtering to work when
> WHERE clause is present

Will Philip's test be put into the test suite anyway, to be sure we
catch regression?

Cheers,
Arjen.

Arjen Lentz, Exec.Director @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.

Follow us at http://openquery.com/blog/ & http://twitter.com/openquery

Comment by Sergei Petrunia [ 2010-12-02 ]

Re: Query returns less rows when run with join_cache_level=6 on maria-5.3-dsmrr-cpk
Yes, added testcase to the testsuite.

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

Launchpad bug id: 623315

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