Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb执行计划不准问题,有tiflash不走,强制走tiflash快很多
A SQL statement, with the latest collected statistics, normally doesn’t use TiFlash but uses TiKV, resulting in much worse performance. It seems that TiDB’s execution plan selection still has issues.
Execution plan as follows:
Execution plan as follows:
I’ve encountered a similar issue. My current solution is to provide independent TiDB server nodes for large-scale queries and set the engine to the TiFlash standalone engine.
Why does your SQL have to use TiFlash? I don’t see any aggregate functions…
Collect the statistics and take a look.
Statistics have been collected.
In that case, the CBO probably doesn’t think it should be used. If it doesn’t work, you can manually intervene with a hint.
Add a hint to manually specify.
Set the engine to the standalone TiFlash engine, and the query reports an error.
Looking at the execution plan, the estimated number of rows scanned by TiKV is significantly less than that of TiFlash. It doesn’t seem right. Could it be that the index is not effective or something like that?
There is no such thing as indexes in TiFlash, right?
Columnar databases don’t seem to require creating indexes like row-based databases do.
Can I use plan replayer to provide feedback?
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.