Does Tiflash add a caching mechanism, similar to the operator pushdown cache in KV, to directly return results on the next hit?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Tiflash 是否增加缓存机制,类似kv的算子下推缓存,下次命中直接返回

| username: Running

TiFlash itself is used for analytical scenarios and has a large number of repetitive identical SQL query operations, especially in BI scenarios where n users access the same page and perform n queries. Can this query be cached and returned directly?

| username: 箱子NvN | Original post link

My understanding is that all queries are received by the TiDB server. If it is the same query, after the first query retrieves results from TiFlash, the results will be stored in the TiDB server’s membuffer. When the query is executed again, it should be able to directly fetch the results from the membuffer.

After watching the course Core Principles and Architecture of TiDB Database [TiDB v6], it seems that the video does not mention any functionality for caching query results between TiFlash and TiDB.

| username: WalterWj | Original post link

The cache in TiKV is actually the region cache, which stores metadata and SQL result information. TiFlash indeed hasn’t implemented something similar yet.

| username: h5n1 | Original post link

The TiDB server has a coprocess cache that caches the results of push-down operators from TiKV, which is suitable for small tables and data that doesn’t change much. You need to consider memory and data changes that cause invalidation. In TiFlash, the tables are generally larger and likely to change more frequently, so it seems less suitable for caching results.

| username: 箱子NvN | Original post link

Additionally, I just reviewed TiDB’s cache and checked the official website.

| username: 箱子NvN | Original post link

I searched for the keyword “tiflash cache” and actually found one.


image
It seems like this thing should be used by tiflash. However, there is only this related entry in the documentation, and it’s from version 4.0.9.
Personally, I think if you’re not too particular, the cache in the membuffer of the tidb server should be sufficient.

| username: tidb狂热爱好者 | Original post link

You all have studied this very thoroughly. TiFlash basically uses statistics, and a single row change makes it really unsuitable for caching.

| username: alfred | Original post link

The use case of TiFlash is indeed not related to caching. You can refer to how Oracle converts tables to columnar format and uses appropriate compression algorithms to store them in memory, accelerating analytical queries.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. No new replies are allowed.