pingcap / pingcap/tidb

Inconsistent results after disabling some optmization rules

Open
#57,862 0 comments 0 reactions 0 assignees View on GitHub
may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
```sql
create table `t0` (`col1` int not null,`col2` varchar(32) not null,`col3` int not null,unique(`col1`, `col2`)) partition by key (`col2`) partitions 4;
insert into `t0` values (1,'a',1),(2,'b',2);

delete from mysql.opt_rule_blacklist;
admin reload opt_rule_blacklist;
select `col1`,`col2`,`col3` from `t0` where `col1`=1 and `col2`='a' or `col1`=3 and `col2`='c';
INSERT INTO mysql.opt_rule_blacklist VALUES("predicate_push_down"), ("partition_processor");
ADMIN reload opt_rule_blacklist;
select `col1`,`col2`,`col3` from `t0` where `col1`=1 and `col2`='a' or `col1`=3 and `col2`='c';
```

### 2. What did you expect to see? (Required)
Queries return same result

### 3. What did you see instead (Required)
```sql
mysql> delete from mysql.opt_rule_blacklist;
Query OK, 0 rows affected (0.00 sec)

mysql> admin reload opt_rule_blacklist;
Query OK, 0 rows affected (0.01 sec)

mysql> select `col1`,`col2`,`col3` from `t0` where `col1`=1 and `col2`='a' or `col1`=3 and `col2`='c';
+------+------+------+
| col1 | col2 | col3 |
+------+------+------+
| 1 | a | 1 |
+------+------+------+
1 row in set (0.00 sec)

mysql> INSERT INTO mysql.opt_rule_blacklist VALUES("predicate_push_down"), ("partition_processor");
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0

mysql> ADMIN reload opt_rule_blacklist;
Query OK, 0 rows affected (0.00 sec)

mysql> select `col1`,`col2`,`col3` from `t0` where `col1`=1 and `col2`='a' or `col1`=3 and `col2`='c';
Empty set (0.01 sec)
```

### 4. What is your TiDB version? (Required)
```sql
Release Version: v8.5.0-alpha-79-g426ce3e570
Edition: Community
Git Commit Hash: 426ce3e57069afbd8f061d7ae39c79d3f9e2ff5d
Git Branch: master
UTC Build Time: 2024-11-09 12:25:03
GoVersion: go1.23.0
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.