How to determine if the data retrieved by SQL execution in TiDB's execution plan is from TiKV disk or memory cache?

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

Original topic: TIDB 的执行计划中如何查看SQL执行获取的数据是来自tikv磁盘还是内存缓存?

| username: 春风十里

[TiDB Usage Environment] Test/PoC
[TiDB Version] 7.5
[Encountered Problem: Problem Phenomenon and Impact]
In the execution plan, how can we see which data during the execution of this SQL is retrieved from TiKV’s disk, which is retrieved from TiKV’s memory, or whether it is cached in TiDB’s memory?

For example, in the execution plan below, is there a place to view the above data?
SQL Execution Plan.xlsx (9.3 KB)

| username: zhanggame1 | Original post link

copr_cache_hit_ratio: 0.91
Refer to Coprocessor Cache | PingCAP Docs

rocksdb: {key_skipped_count: 410870, block: {cache_hit_count: 3001}}}

Refer to Slow Query Log | PingCAP Docs

| username: Kongdom | Original post link

I think it’s enough to focus on the task column.

One type is called root task, which is executed on the tidb-server, and another type is called cop task, which is executed in parallel on TiKV or TiFlash.

| username: 春风十里 | Original post link

RocksDB reads data from the Block Cache. How should this count be understood? Is it based on a block size of 64k by default?

| username: zhanggame1 | Original post link

It should be 32K

| username: wangccsy | Original post link

Beginner learning.

| username: 春风十里 | Original post link

Yes, I was misled by a certain post where the AI replied 64k, but it should actually be 32k by default.

| username: dba远航 | Original post link

Glad it’s resolved.

| username: 江湖故人 | Original post link

It’s worth studying in detail how to interpret the execution plan :thinking:

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.