Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 可以使用hint强制使用tiflash吗?没有成功,同时希望大佬们帮忙看看语句慢在哪
【TiDB Usage Environment】Production Environment
【TiDB Version】
【Reproduction Path】Using hint was unsuccessful
【Encountered Problem: Problem Phenomenon and Impact】
【Attachment: Screenshot/Log/Monitoring】
I am currently using this method to force the use of TiFlash. I don’t know how to use hint and would like to ask how to use it.
Untitled.xlsx (11.9 KB)
Test SQL.sql (11.3 KB)
/*+ READ_FROM_STORAGE(TIFLASH[PCODE]) */
Please refer to this link:
Try collecting some statistics.
The image is not available for translation. Please provide the text content directly for translation.
You need to add --comments for it to take effect.
There must be replicas; otherwise, how could I have added TiFlash?
What does statistical information refer to?
Was this section of the script executed? How was it assigned?
– set @@session.tidb_isolation_read_engines=‘tikv,tiflash’;
This is recursion, right? I wonder if it can work within recursion.
Executed it, but it didn’t work, it won’t recurse.
Aren’t we talking about TiDB? How is this related to MySQL?
Have you configured TiFlash in the engines section of the configuration document?
Instance level for TiDB, i.e., INSTANCE level. Add the following configuration items to the TiDB configuration file:
[isolation-read]
engines = [“tikv”, “tidb”, “tiflash”]
Collect the statistics of the related tables.
Analyze the table, analyze table tablename
Check if the available replica is 1 by running select * from information_schema.tiflash_replica;
.
Have all the tables in the SQL constructed TiFlash replicas? If they all have, change the engine to TiFlash.
set @@session.tidb_isolation_read_engines = "tiflash";
Then execute the SQL again.