Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_index_merge return wrong result #23112

Closed
ChenPeng2013 opened this issue Mar 4, 2021 · 3 comments · Fixed by #23132
Closed

use_index_merge return wrong result #23112

ChenPeng2013 opened this issue Mar 4, 2021 · 3 comments · Fixed by #23132
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
drop table if exists t;
CREATE TABLE `t` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  KEY `a` (`a`),
  KEY `b` (`b`),
  KEY `c` (`c`),
  KEY `d` (`d`),
  KEY `c_2` (`c`,`d`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

insert into t values(10, 1,1,1,1);
select /*+ use_index_merge(t) */ * from t where t.a=10 or (t.b=10 and t.e=10);

2. What did you expect to see? (Required)

mysql> select /*+ use_index_merge(t) */ * from t where t.a=10 or (t.b=10 and t.e=10);
+------+------+------+------+------+
| a    | b    | c    | d    | e    |
+------+------+------+------+------+
|   10 |    1 |    1 |    1 |    1 |
+------+------+------+------+------+
1 row in set, 1 warning (0.01 sec)

3. What did you see instead (Required)

mysql> select /*+ use_index_merge(t) */ * from t where t.a=10 or (t.b=10 and t.e=10);
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

master v4.0.0-beta.2-2274-gdb62e341f
release-5.0-rc v5.0.0-rc-21-g8304d661f
release-4.0 v4.0.11-10-g38f9bdd81

@ChenPeng2013 ChenPeng2013 added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner severity/critical labels Mar 4, 2021
@eurekaka
Copy link
Contributor

eurekaka commented Mar 4, 2021

QA verified that the problem was introduced in 4.0.9.

@wjhuang2016
Copy link
Member

Introduced by #20425

@ti-srebot
Copy link
Contributor

ti-srebot commented Mar 8, 2021

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

[v4.0.9:v4.0.11],[v5.0.0-rc]

6. Fixed versions

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants