pingcap / pingcap/tidb

planner: support exporting historical stats / replayer

Open
#66,636 1 comment 0 reactions 0 assignees View on GitHub
component/statistics sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

A slow query usually isn't discovered right away. It may show up later in slow logs, dashboards. By then, the stats the optimizer used can have changed due to `auto-analyze` or `modify_cnt_update`.
Without the runtime stats at that time, we can't reproduce this slow query plan, which prevents us from investigating the root cause.
We can consider using the current `version` columns in our stats tables to implement MVCC for stats, for example, keep all versions of stats within a period of time, like 1 week:

Image

Then we can support exporting any specific version of stats in the past 1 week: `plan replayer dump with {time-stamp or version-number} {select}`

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.