pingcap / pingcap/tidb

planner: different plans get the same plan digest in slow log

Open
#46,864 0 comments 0 reactions 2 assignees Claimed by @time-and-fate View on GitHub
affects-7.1 affects-7.2 affects-7.3 severity/moderate 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)

1. deploy a tidb cluster with 7.1.0
2. using tiup bench to run the CH 1000 warehouse benchmark

### 2. What did you expect to see? (Required)
Each plan had its unique plan digest in a slow log
```
/*q9*/
SELECT
n_name,
extract(
year
FROM
o_entry_d
) AS l_year,
sum(ol_amount) AS sum_profit
FROM
item,
stock,
supplier,
order_line,
orders,
nation
WHERE
ol_i_id = s_i_id
AND ol_supply_w_id = s_w_id
AND mod((s_w_id * s_i_id), 10000) = s_suppkey
AND ol_w_id = o_w_id
AND ol_d_id = o_d_id
AND ol_o_id = o_id
AND ol_i_id = i_id
AND s_nationkey = n_nationkey
AND i_data LIKE '%BB'
GROUP BY
n_name,
extract(
year
FROM
o_entry_d
)
ORDER BY
n_name,
l_year DESC;
```

### 3. What did you see instead (Required)
Two plans of the Q9 in the CH benchmark get the same plan digest `4285855f2de90efa986aac83feed5e92f7d891ad702dbb5940cd660143bc6296`
![image](https://github.com/pingcap/tidb/assets/84501897/00e4523f-0152-40a9-8acb-9d822b4557af)

### 4. What is your TiDB version? (Required)

v7.1.0, v7.2.0, 7.3.0, nightly

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.