tidb统计信息报错

tidb的统计信息报错:
1、表的字段非常多,大概2500个字段
2、表存在分区,128个分区
报错信息如下:
*************************** 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

重新执行:analyze table xxxxxxxxxxxx; 最后也执行不成功。

手动analyze一下这个分区,看下返回结果是什么,分区表第一次进行analyze,是需要逐个分区都手动analyze后,才能正确生成全局的统计信息

另外看你的描述,这个是Hash分区?TiDB上除非为了冷热分离,或者方便删除历史数据,最好别用分区。尤其是Hash分区,绝大多数场景下都用不到它。

1 个赞

楼主重新analyze 收集统计信息应该就可以解决问题了

重新执行:analyze table custom_forms_user_detail

重新analyze也不行?难道是因为analyze的时候有频繁操作?不过看分区和字段确实挺多的