Analyze Bug

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: analyze bug

| username: db_user

Bug Report
Clearly and accurately describe the issue you found. Providing any steps to reproduce the problem can help the development team address it promptly.
[TiDB Version]
4.0.13
[Impact of the Bug]
No change in health status after analyze

Phenomenon:
Log error:
Errors for two tables
[error=“[types:1406]Data Too Long, field len 40, data len 64”]
[error=“[types:1406]Data Too Long, field len 10, data len 16”]
etc.

Trigger method:
Triggered every time analyze is called, the field lengths of the analyzed table are 40 and 10.

Impact:
After calling analyze, the client can execute normally, and no warning information is returned to the client. However, the log records the above warning information, and there is no change in health status after analyze.

Methods tried:
DROP STATS TableName; had no effect

Similar issue:

Similar community issue:

PS:
It’s not upper_bound, it’s a different error.

| username: db_user | Original post link

Resolved

Steps:

  1. Set the auto-analyze to a non-current time to ensure it won’t auto-analyze at the moment.
set global tidb_auto_analyze_start_time='00:00 +0000'
  1. Delete the statistics of the table.
DROP STATS db_name.table_name
  1. Manually analyze the table.
analyze table db_name.table_name

(At this point, the issue is resolved, and the health status is restored to 100.)

  1. Restore auto-analyze.
set global tidb_auto_analyze_start_time=

Reason: It might be due to inaccurate statistics, which caused the auto-analyze to fail continuously. Therefore, the above steps are needed.

However, the root cause still needs to be reviewed by the development experts.

Additionally, there is another phenomenon. I observed several tables with alerts, and the phenomenon is consistent:

Data Too Long, field len 255, data len 284

For example, this error indicates that a field in the table is defined with a length of 255, but the maximum length of this field is 142. All such data length alerts are twice the maximum field length.

| username: Kongdom | Original post link

:call_me_hand: Excellent DBAs solve problems on their own!

| username: BraveChen | Original post link

I just finished reading the question and realized you solved it yourself.

| username: db_user | Original post link

I just don’t understand the reason, my code reading skills are still poor.

| username: db_user | Original post link

The main reason is not very clear.

| username: db_user | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.