pingcap / pingcap/tidb

planner: `tidb_enable_new_only_full_group_by_check` cause plan-cache hit ratio regression on `sysbench`

Open
#45,519 0 comments 0 reactions 1 assignee Claimed by @qw4990 View on GitHub
affects-7.1 epic/plan-cache sig/planner type/enhancement type/performance
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

After enabling `tidb_enable_new_only_full_group_by_check`, the query below cannot hit the plan-cache:

```
CREATE TABLE `sbtest1` (
`id` int(11) NOT NULL, `k` int(11) NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '', `pad` char(60) NOT NULL DEFAULT '',
PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */, KEY `k_1` (`k`));

mysql> set tidb_enable_new_only_full_group_by_check=on;
Query OK, 0 rows affected (0.00 sec)

mysql> prepare st from 'select c from sbtest1 where id between ? and ?';
Query OK, 0 rows affected (0.00 sec)

mysql> set @a=1, @b=4;
Query OK, 0 rows affected (0.00 sec)

mysql> execute st using @a, @b;
Empty set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+-------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------+
| Warning | 1105 | skip prepared plan-cache: %v affects null check |
+---------+------+-------------------------------------------------+
1 row in set (0.00 sec)
```

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.