Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 执行计划分析
Can someone analyze this SQL for me? Is there any room for optimization?
Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 执行计划分析
Can someone analyze this SQL for me? Is there any room for optimization?
The statistics for table b are inaccurate. It is recommended to recollect them. Additionally, you can run an EXPLAIN ANALYZE to check. If it is a production environment, evaluate the impact of execution.
Is table B large? If it is, directly using a hint will bypass the index on table A.
As soon as you see stats:pseudo, you can directly perform table statistics collection.
analyze table net_nasipschoollocate
If you only need to retrieve ‘a’ from the result set, you can try using exists.
Try creating a composite index on table a with (schoolcode, tick_useripint).
Where can it be analyzed that the statistics of table B are inaccurate?
Seeing stats:pseudo generally indicates that the statistics are not very accurate, which is a hint given by TiDB.
Aren’t you a hash join? It’s approximately equal to the product of the number of rows in your two result sets, 3024840.37 * 5.98.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.