pingcap / pingcap/tidb

planner: Explain Explore returns a new column to help user create bindings more easily

Open
#65,987 0 comments 0 reactions 1 assignee Claimed by @AilinKid View on GitHub
sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
Now `Explain Explore` returns a SQL like `CREATE GLOBAL BINDING FROM HISTORY USING PLAN DIGEST 'fb7ba1191ca76f8d9a73c7180d7ba3cbb4043dec48ceb45752d0796006a190c7'` to help users create such a binding.
But this `USING PLAN DIGEST` command requires this plan to be stored in `mysql.statement_summary`, but on the cloud, `mysql.statement_summary` might not be available.
But if we return the whole original query like `CREATE GLOBAL BINDING USING SELECT /*+ */ * FROM ...`, the result could be too long and contain some invisible characters, which prevent the user from copying and pasting the command to create such a binding.

To solve this, maybe we could return a new column like `CREATE GLOBAL BINDING USING 'a3F...xtP'`, where `a3F...xtP` is base64 encoded and compressed from the original query, which is used to make the result shorter and remove all invisible characters.

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.