planner: support exporting historical stats / replayer
- 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:
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
Assessment
This issue has not been assessed yet.