-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner: tot_col_size
in mysql.stats_histograms might be a negative number
#55126
Labels
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
component/statistics
report/customer
Customers have encountered this bug.
severity/moderate
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Comments
qw4990
added
type/bug
The issue is confirmed as a bug.
component/statistics
sig/planner
SIG: Planner
severity/moderate
labels
Aug 1, 2024
13 tasks
ti-chi-bot
added
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
labels
Aug 11, 2024
/report customer |
13 tasks
13 tasks
This was referenced Aug 23, 2024
13 tasks
This was referenced Sep 29, 2024
EricZequan
pushed a commit
to EricZequan/tidb
that referenced
this issue
Sep 29, 2024
13 tasks
This was referenced Oct 29, 2024
13 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
component/statistics
report/customer
Customers have encountered this bug.
severity/moderate
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
It seems like the negative number is caused by this modification: https://github.com/pingcap/tidb/blob/v6.5.6/table/tables/tables.go#L477-L490
The current method to maintain the
col_size
:mysql.stats_histograms.tot_col_size
each time when there is a DML statement (see https://github.com/pingcap/tidb/blob/v6.5.6/table/tables/tables.go#L477-L490);avg_col_size
bymysql.stats_histograms.tot_col_size / mysql.stats_histograms.not_null_count
when actually using it in the cost model;The behavior above seems overly complex, which might cause unexpected result like the negative number here.
A better/simpler/robuster way to maintain
avg_col_size
seems to calculate and store it directly inanalyze
.2. What did you expect to see? (Required)
The tot_col_size should be equal or large than 0.
3. What did you see instead (Required)
A negative number.
4. What is your TiDB version? (Required)
v6.5.6
The text was updated successfully, but these errors were encountered: