pingcap / pingcap/tidb

planner: treat plans with different in-list length as the same one in plan cache

Open
#42,984 1 comment 0 reactions 1 assignee Claimed by @qw4990 View on GitHub
epic/memory-management epic/plan-cache sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

Currently, for 2 'same' queries with different in-list lengths, plan cache will generate and cache different plans for them.
For example, plan cache will cache 2 plans for the 2 'same' queries below:
`select * from t where a in (1, 2)`, `select * from t where a in (1, 2, 3)`.

This strategy can cause lots of memory usage:
![image](https://user-images.githubusercontent.com/7499936/231415058-feb19e55-bcee-4579-bc3a-dc572e2b6a5f.png)

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.