Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: tidb SQL执行计划显示走tiflash,执行时间变长
To improve efficiency, please provide the following information. Clear problem descriptions can be resolved faster:
[TiDB Usage Environment]
tidb v.4.0.8
[Overview] Scenario + Problem Overview
±-----------------------------------±--------±----------±----------------------------------------------------------------------------------
| id | estRows | task | access object
±-----------------------------------±--------±----------±----------------------------------------------------------------------------------
| StreamAgg_15 | 1.00 | root |
| └─HashAgg_43 | 9.71 | root |
| └─IndexLookUp_44 | 9.71 | root |
| ├─IndexRangeScan_25(Build) | 7157.63 | cop[tikv] | table:t, partition:p20220727, index:idx_xxxx_hour(advertiser_id, report_time) |
| └─HashAgg_39(Probe) | 9.71 | cop[tikv] |
| └─TableRowIDScan_26 | 7157.63 | cop[tikv] | table:t, partition:p20220727 |
±-----------------------------------±--------±----------±----------------------------------------------------------------------------------
6 rows in set (0.01 sec)
[Background] What operations have been done
[Phenomenon] Business and database phenomena
[Problem] Current problem encountered
Two execution plans, the execution plan using tikv is more efficient, while using tiflash is slower. I don’t understand why the execution plan automatically chooses to execute on tiflash?
[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 problem)
If the question is related to performance optimization or fault troubleshooting, please download the script and run it. Please select all and copy-paste the terminal output results and upload them.