Skip to content

planner: same plans with different in-list should have the same plan digests #66623

@qw4990

Description

@qw4990

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

tiup playground  --db 1  --kv 1 --tiflash 0 nightly

create table t (a int);

select * from t where a in (1, 2);
select * from t where a in (1, 2, 3);
select * from t where a in (1, 2, 3, 4);
select * from t where a in (1, 2, 3, 4, 5);
select * from t where a in (1, 2, 3, 4, 5, 6);
select * from t where a in (1, 2, 3, 4, 5, 6, 7);

These queries and plans are the same, but the Dashboard is flooded with different plans, which significantly affect the user experience:

Image

The root cause is that they have different plan digest, we need to update our plan digest algorithm to ignore different length of in-list:

mysql> select DIGEST_TEXT, DIGEST, PLAN_DIGEST from STATEMENTS_SUMMARY where DIGEST='27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0';
+----------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+
| DIGEST_TEXT                            | DIGEST                                                           | PLAN_DIGEST                                                      |
+----------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+
| select * from `t` where `a` in ( ... ) | 27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0 | 35c33c6a4ce69189ba638adc43b84513811732513665bb3a805e4ab888360de9 |
| select * from `t` where `a` in ( ... ) | 27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0 | 23ea30430e8bd8c0845e8fabceb217e98a743dc0a3b42e63555abd39cb77ccf6 |
| select * from `t` where `a` in ( ... ) | 27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0 | 32da2ca4acd7d0536a2da4a59c8e9e5c75088dbb1e87a76e07646fafe5652ce9 |
| select * from `t` where `a` in ( ... ) | 27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0 | 59a89207acb798c0400404a3bc47df2147370b7dea3765afc37f8f27f3ff0e0e |
| select * from `t` where `a` in ( ... ) | 27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0 | ddbf412c92228a757994b14210801d86f61eb9b510e6bc36dca75d5d4151ad02 |
| select * from `t` where `a` in ( ... ) | 27b5708e7f94f1ad32ba9ef1475f1a9c0225444f97f5d495f7d642182635e9d0 | 01308613e49648a4431351439f0596ce1236bc671f9ced66c04bc19b2b8b2c38 |
+----------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------+
6 rows in set (0.002 sec)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Master

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions