pingcap / pingcap/tidb

Plan Cache Should Not Differentiate Precision for Decimal Fields in Execution Plans

Open
#58,576 0 comments 0 reactions 1 assignee Claimed by @qw4990 View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

During the process of simulating customer workloads, it was discovered that for decimal fields, differences in precision—whether for the integer part or the fractional part—result in different execution plans, causing cache misses. Both float and double types have the same issue.Let's take decimal as an example."
```
mysql> show create table t;
+-------+-----------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------+
| t | CREATE TABLE `t` (
`a` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+-----------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```

example1
![Image](https://github.com/user-attachments/assets/24e2d196-63cc-4eef-98f1-8bda1b631ac3)

example2
![Image](https://github.com/user-attachments/assets/79fcded0-3a70-477d-aa52-d5620524dd47)

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.