Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: sql执行计划走了错误的索引
To improve efficiency, please provide the following information. Clear problem descriptions can lead to faster resolutions:
[TiDB Usage Environment]
tidb 5.4.0, centos 7.5
[Overview] Scenario + Problem Overview
Recently upgraded TiDB to 5.4.0 and found that it always uses the wrong index. Each time after manual parsing, it gets better, but after a while, it uses the wrong index again.
Dashboard execution plan, using the wrong index
Execution time 2.4 seconds
Table health
Table index structure
After manual parsing, it completes instantly
After manual parsing, the execution plan uses the correct index
The statistics version is 1. We just upgraded from 4.0.13 to 5.4.0
[Background] Operations performed
[Phenomenon] Business and database phenomena
[Problem] Current issue encountered
Is there any way to solve this problem? Thank you.
[Business Impact]
[TiDB Version]
[Application Software and Version]
[Attachments] Relevant logs and configuration information
- TiUP Cluster Display information
- TiUP Cluster Edit config information
Monitoring (https://metricstool.pingcap.com/)
- TiDB-Overview Grafana monitoring
- TiDB Grafana monitoring
- TiKV Grafana monitoring
- PD Grafana monitoring
- Corresponding module logs (including logs 1 hour before and after the issue)
If the question is related to performance optimization or troubleshooting, please download the script and run it. Please select all and copy-paste the terminal output results for upload.