The table identified in the TiDB EXPLAIN ANALYZE statement cannot be found in the SQL query

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

Original topic: tidb explain analyze 中识别的表sql语句中找不到

| username: Jjjjayson_zeng

[TiDB Usage Environment] Production Environment
[TiDB Version]
[Reproduction Path] Query
[Encountered Problem: Problem Phenomenon and Impact] The table identified in tidb explain analyze cannot be found in the SQL statement
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Log/Monitoring]


As shown in the figure, the aac table cannot be found in the statement, tried several times.

| username: xingzhenxiang | Original post link

Did you create an alias?

| username: Jjjjayson_zeng | Original post link

No alias either.

| username: 有猫万事足 | Original post link

Still prioritize suspecting aliases.

Removing some of the query conditions will make it easier to find the issue.
Also, with the entire table having 7000+ rows and being able to find 166 based on the ID, if you are familiar with the business, it should be easy to locate.

| username: 大飞哥online | Original post link

SQL statement and table structure, please.

| username: Jjjjayson_zeng | Original post link

test.sql (457.7 KB)

| username: Jjjjayson_zeng | Original post link

The table structure is too complex, it’s not easy to provide.

| username: 大飞哥online | Original post link

SQL multi-table joins and nesting, you can only use EXPLAIN layer by layer to see where the AAC table is faster. I don’t have the environment here, so I can’t check it.

| username: Jjjjayson_zeng | Original post link

The problem is that there is no table with the alias acc at all.

| username: 大飞哥online | Original post link

Individually, there is none. You need to see where it is generated, so it’s better to analyze step by step.

| username: 啦啦啦啦啦 | Original post link

Check if there is a view, and the table in the view has an alias, which might be causing the issue.
For example:

CREATE VIEW view_test AS 
SELECT * 
FROM sbtest1 as aac;
| username: Jjjjayson_zeng | Original post link

There is a view, let me take a look, thank you.

| username: system | Original post link

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