pingcap / pingcap/tidb

The plan replayer failed to restore the last update version of the histogram correctly

Open
#63,402 6 comments 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

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

1. Get a valid plan replayer with some statistics
2. Check the last update version from the stats JSON file
3. Import it into the new cluster
4. Check the last update version from the `mysql.stats_histograms` table.

### 2. What did you expect to see? (Required)
The version is same.

### 3. What did you see instead (Required)
When we restore the stats, we will insert the histogram with the current timestamp.

### 4. What is your TiDB version? (Required)

```sql
+-----------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-45-gbe0ce885d0 |
| Edition: Community |
| Git Commit Hash: be0ce885d0c8d382af209636597e3fce64bc99a7 |
| Git Branch: HEAD |
| UTC Build Time: 2025-07-03 09:59:59 |
| GoVersion: go1.23.10 |
| Race Enabled: false |
| Check Table Before Drop: false |
| Store: tikv |
| Kernel Type: Classic |
+-----------------------------------------------------------+

(END)
```

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.