Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: hints不生效问题
The issue I encountered is that I added a hint in the SQL to make table A use the KV engine, but it didn’t take effect. What could be the reason?
Currently, it is turned off. Is it related to that?
Are there any warnings when executing the SQL? If so, use “SHOW WARNINGS” to see the details.
Thank you for the help. When I turned on both of these, it might have followed the hint. But if I forcefully turn off MPP, the optimizer fully uses MPP. Then I was quite curious. Using the KV index was not as fast as MPP. I have no confidence in handling the performance of such complex SQL.
The main thing is to look at the specific amount of data you are scanning. If you are scanning a particularly large amount of data using the KV index without using TiFlash MPP, it is expected that the efficiency will be lower. KV is more suited for point queries and small data range scans, while TiFlash is more suited for AP-type full table scans.
The SQL I posted above has about 100 million rows per table. The largest table, B, has 300 million rows. Each table has indexes created based on the SQL query, and the indexes are being used as expected. However, I noticed that the computation between the root layer and the KV layer has become slower than using MPP. I’m not sure if this is related to the deployment topology. Currently, the db-server and kv-server are deployed on the same machine.
When performing an index scan and returning to the table, the index records are first returned to TiDB, then TiKV is scanned to return the data to TiDB, and then it is associated with another table.
Could you provide the execution plans for both TiKV and TiFlash? Let’s check the specific scan data volume of the index scan and the number of rows returned.
Memory keeps exploding. I’ll first check the data volume. Several terabytes of data might be a bit too much for the current environment configuration.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.