pingcap / pingcap/tidb

optimizer trace should also support Prepare statement and Execute statement.

Open
#43,960 0 comments 0 reactions 0 assignees View on GitHub
sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

Sometimes, we can always tell from the slow-log file whether a query **A** is from the cached plan or not.

Since it has existed in the slow-log file, there must be some performance problems with them, for example, **rewriting time-consuming**, **optimization time-consuming**, or even **execution time-consuming**. The third one is not about Plan-Cache's businesses because the non-prepared statement should have the same execution time-consuming problem as well. We mainly talk about the first two cases.

We may easily hear that one's compile-time is not as expected, taking up **X** hundred milliseconds or so in plan cached cases:
* step 1: For the most intuitive decision is to cache that plan again.
* step 2: Then the second intuitive action is to figure out **Why does compile time takes up such a large human-perceivable proportion**. (maybe some resource bottleneck can be detected, or a workload burden)

This enhancement can help with the second step here.

![img_v2_8bdb6e72-3a83-4365-a300-fbf4a53d030g](https://github.com/pingcap/tidb/assets/15825830/ea2c4e23-9646-40aa-bb5b-5e6df11da083)

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.