[MDEV-5821] Wrong result of SELECT query while two indexed colums are in WHERE section Created: 2014-03-11  Updated: 2014-03-11  Resolved: 2014-03-11

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.36, 10.0.9
Fix Version/s: 5.5.37, 10.0.10

Type: Bug Priority: Major
Reporter: Vojtech Benes (Inactive) Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: optimizer
Environment:

Centos 6.5 64bit base install


Attachments: File test.sql.tar.gz    
Issue Links:
Relates
relates to MDEV-5177 ha_partition and innodb index interse... Closed

 Description   

Problem occurs on test table, which consists of two indexed comlumns and primary key column. With following query:

SELECT count(*)
FROM `test`
WHERE `col2` = '636146' AND `col1` = '7+';

result: 0

Same query while running after:

SET optimizer_switch='index_merge=off';

result: 73

I attach my test database, which is derived from production database where issue occurs. I was able to reproduce problem on several other systems.

I was unable to reproduce same error on MySQL 5.5.35

Issue might be related to "intersect(col1,col2);" in query EXPLAIN, while any modification of query (eg. adding OR condition to WHERE expression) seems to avoid the issue. Deleting primary key (which is not involved in query), changing table to MyISAM seems to cause correct behavior of system.



 Comments   
Comment by Elena Stepanova [ 2014-03-11 ]

Reproducible with the data from the attachment and the query from the description: on 5.3 (14/73 rows), 5.5, 10.0 (0/73 rows), mysql-5.6 (70/73 rows).

The bug is likely to be a duplicate of MDEV-5177, but since the latter turned out to be tricky, I suggest to make sure the bugfix covers this test case as well before closing it.

Comment by Sergei Petrunia [ 2014-03-11 ]

Elena, is it reproducible on MySQL 5.6.16 or on MySQL 5.6.15?

Comment by Elena Stepanova [ 2014-03-11 ]

I'm using the top of the public mysql-server/5.6 bzr tree, which has revno 5732 (tag mysql-5.6.16), dated 2014-01-09.

Comment by Sergei Petrunia [ 2014-03-11 ]

Ok, I can repeat this bug when I try on mariadb-5.5 without fix for MDEV-5177, and I cannot repeat it when fix for MDEV-5177 is applied. Other things also hint this is the same issue.

Comment by Sergei Petrunia [ 2014-03-11 ]

Fixed by fix for MDEV-5177. Fix for MDEV-5177 is pushed into 5.5 tree.

Comment by Sergei Petrunia [ 2014-03-11 ]

Vojtech, thanks for taking time to report the issue. Although this one has turned out to be already known, we (MariaDB devs) appreciate getting input.

Comment by Vojtech Benes (Inactive) [ 2014-03-11 ]

Thank you for fix. I'll be waiting for next release. In meantime I'll use 'index_merge=off' as workaround.

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