Unable to analyze table

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

Original topic: 无法analyze表

| username: CHENGX

【TiDB Usage Environment】Production Environment / Testing / PoC
【TiDB Version】
【Reproduction Path】What operations were performed when the issue occurred
【Encountered Issue: Problem Phenomenon and Impact】
【Resource Configuration】Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots / Logs / Monitoring】
ANALYZE TABLE JHVIEW.V_API_HDR_VISIT

1105 - Primary key column not found

| username: tidb菜鸟一只 | Original post link

ADMIN CHECK TABLE tbl_name;
Check the result.

| username: CHENGX | Original post link

Sure, I’ll give it a try. Can it be executed during peak business hours?

| username: CHENGX | Original post link

Execution is OK.

| username: CHENGX | Original post link

After execution, the above error is still prompted.

| username: Jasper | Original post link

Please provide the table structure.

| username: tidb菜鸟一只 | Original post link

show create table table_name;
Can you normally select from this table?

| username: 托马斯滑板鞋 | Original post link

Is this a view?

| username: DBAER | Original post link

It is indeed possible, there is a v

| username: Jasper | Original post link

It’s not a view. I tried to analyze the view and got this error:

| username: 小龙虾爱大龙虾 | Original post link

Check the TiDB Server logs, it doesn’t seem quite normal.

| username: CHENGX | Original post link

| username: CHENGX | Original post link

It can perform select normally, but the execution plan is not accurate, so I wanted to analyze it and found an error.

| username: CHENGX | Original post link

Creating an empty table allows for normal analysis, but after inserting some data, the analysis fails.

| username: CHENGX | Original post link

The image you provided is not accessible. Please provide the text content that needs to be translated.

| username: CHENGX | Original post link

| username: 小龙虾爱大龙虾 | Original post link

What I mean is, when you analyze, do you check the logs for any errors?

| username: miya | Original post link

Is it missing a keyword? You can try with “explain analyze select * from t”.

| username: changpeng75 | Original post link

Is it possible to restart TiDB? If so, add ‘enable-error-stack = true’ under the [log] section of tidb.toml, and then check the specific output information in tidb.log.

| username: 源de爸 | Original post link

First, show us the table structure.