Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make extracting information from execution plans easier in the code and reduce the repeated code #35888

Open
time-and-fate opened this issue Jul 1, 2022 · 0 comments
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@time-and-fate
Copy link
Member

Enhancement

Currently, in tidb code, when we want to get some information from an execution plan, we have to implement a method for the planner/core.Plan type. Usually, we have to iterate through the tree in the method. And sometimes, we will collect some basic information in different places.

This causes some unnecessary repeated code and some bugs:
#28731 Generating the execution plan text from a Plan is repeated for the EXPLAIN statement, statements summary, and slow log/slow query. And their results are different.
#35687 The logic of iterating the plan tree is updated because of new operators, but only for EXPLAIN statements. The logic for stmt summary and the slow query/log is missed.

And we are still adding more methods to extract different information from Plan in different places. So it's better if we can make it more convenient and reduce repeated code.

A possible solution: #28731 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant