pingcap / pingcap/tidb

binding: `create binding from {plan_digest}` can't distinguish different plans with same digest but different schema

Open
#63,410 1 comment 0 reactions 1 assignee Claimed by @mjonss View on GitHub
component/bindinfo may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 report/customer 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)

```
create database db1;
create database db2;
create table db1.t (a int);
create table db2.t (b int);
use db1;
select count(*) from t;
use db2;
select count(*) from t;

select schema_name, `digest`, digest_text, plan_digest from information_schema.statements_summary where schema_name in ('db1', 'db2') order by schema_name, `digest`;
+-------------+------------------------------------------------------------------+-----------------------------+------------------------------------------------------------------+
| schema_name | digest | digest_text | plan_digest |
+-------------+------------------------------------------------------------------+-----------------------------+------------------------------------------------------------------+
| db1 | 8e2dde9df445b943a04e3e717096baaafc4f20e463c06b0b7d16e03f529d62d6 | select count ( ? ) from `t` | e93ef02114e6159d76f97ff754bad08443fecb05d1be41afb18b947847befb85 |
| db2 | 8e2dde9df445b943a04e3e717096baaafc4f20e463c06b0b7d16e03f529d62d6 | select count ( ? ) from `t` | e93ef02114e6159d76f97ff754bad08443fecb05d1be41afb18b947847befb85 |
+-------------+------------------------------------------------------------------+-----------------------------+------------------------------------------------------------------+
```

See the case above, these 2 queries are running in different schema but have the same plan digest, then when using our `create binding from {plan_digest}` feature, we can't specify which binding to create.

### 2. What did you expect to see? (Required)
They should have different plan_digest.

### 3. What did you see instead (Required)
They have the same plan_digest.

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

Master

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.