TiDB Statistics Information Error

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

Original topic: tidb统计信息报错

| username: yulei7633

Error in TiDB statistics:

  1. The table has a very large number of columns, approximately 2500 columns.
  2. The table has partitions, 128 partitions.
    Error message is as follows:
    *************************** 30. row ***************************
    Table_schema: ffffffff
    Table_name: xxxxxxxxxx
    Partition_name:
    Job_info: merge global stats for fffffffff.xxxxxxxxxxxx index idx_master
    Processed_rows: 0
    Start_time: 2023-10-16 15:48:10
    End_time: 2023-10-16 15:48:10
    State: failed
    Fail_reason: [types:8244]Build global-level stats failed due to missing partition-level column stats: table custom_forms_user_detail partition p109 index idx_master, please run analyze table to refresh columns of all partitions
    Instance: 10.0.47.4:4000
    Process_ID: NULL

Re-executing: analyze table xxxxxxxxxxxx; also fails in the end.

| username: dba-kit | Original post link

Manually analyze this partition and see what the result is. For a partitioned table, the first time you perform an analyze, you need to manually analyze each partition one by one to correctly generate global statistics.

| username: dba-kit | Original post link

Based on your description, is this a Hash partition? On TiDB, unless it’s for hot and cold data separation or for the convenience of deleting historical data, it’s best not to use partitions. Especially Hash partitions, in most scenarios, they are not needed.

| username: dba-kit | Original post link

The image is not visible. Please provide the text content that needs to be translated.

| username: Jellybean | Original post link

The original poster should be able to solve the problem by re-analyzing and collecting statistics.

| username: Fly-bird | Original post link

Re-execute: analyze table custom_forms_user_detail

| username: Kongdom | Original post link

Re-analyzing doesn’t work either? Could it be because there are frequent operations during the analyze? But looking at the partitions and fields, there are indeed quite a lot.