Coprocessor Cache 少量数据缓存失效?大量数据copr_cache_hit_ratio信息出现在cop[tikv]

CREATE TABLE t2 (
id int(11) NOT NULL,
name varchar(10) DEFAULT NULL,
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */,
KEY name (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin

insert into t2 values(1,‘tom’),(2,‘jack’),(3,‘jerrry’),(4,‘rose’),(5,‘a’),(6,‘b’),(7,‘c’)

EXPLAIN ANALYZE SELECT * FROM t2 USE INDEX(name);
执行很多遍copr_cache_hit_ratio: 0.00 都是0.00

然后执行了一个比较大的表

copr_cache_hit_ratio不是在task:root上而是在task:cop[tikv]上,官网提供的是task:root
想问下这个是什么原因呢?

1 Like

请问你这边的集群版本是多少,有设置过 tikv-client.copr-cache 相关的参数吗?

您好是5.0.2 tikv-client.copr-cache.capacity-mb 都是默认值1000.

在大表上执行的详细执行计划麻烦提供一下,多谢

id                        |estRows|actRows|task     |access object                          |execution info                                                                                                                                                                                                                                                 |operator info                                                                                                |memory  |disk|
--------------------------+-------+-------+---------+---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+--------+----+
IndexLookUp_13            |10.00  |10     |root     |                                       |time:1.05ms, loops:2, index_task: {total_time: 414.2µs, fetch_handle: 410.8µs, build: 683ns, wait: 2.7µs}, table_task: {total_time: 2.78ms, num: 1, concurrency: 5}                                                                                            |                                                                                                             |10.00 KB|N/A |
├─IndexRangeScan_11(Build)|10.00  |10     |cop[tikv]|table:dkf, index:md5_doc_id(md5_doc_id)|time:402.8µs, loops:3, cop_task: {num: 1, max: 377.9µs, proc_keys: 10, rpc_num: 1, rpc_time: 360.5µs, copr_cache_hit_ratio: 0.00}, tikv_task:{time:0s, loops:1}, scan_detail: {total_process_keys: 10, total_keys: 11, rocksdb: {delete_skipped_count: 0, key_s|range:["782eaa5c7bcd2ab26ba88717ec72fb93","782eaa5c7bcd2ab26ba88717ec72fb93"], keep order:false, stats:pseudo|N/A     |N/A |
└─TableRowIDScan_12(Probe)|10.00  |10     |cop[tikv]|table:dkf                              |time:486.5µs, loops:2, cop_task: {num: 2, max: 448.8µs, min: 245.6µs, avg: 347.2µs, p95: 448.8µs, max_proc_keys: 9, p95_proc_keys: 9, rpc_num: 2, rpc_time: 676.3µs, copr_cache_hit_ratio: 0.50}, tikv_task:{proc max:13ms, min:0s, p80:13ms, p95:13ms, iters:2|keep order:false, stats:pseudo                                                                               |N/A     |N/A |

您好上面的这个

好的,我们这边先看下

coprocessor cache 生效的默认条件是它的执行时间大于 500 ms 且切分的 range 比较少而且数据结果不超过 500 MB时才会生效,所以小表的时候可能会不生效

1 Like

优秀,你的这句话是在哪里看到的官网文档吗?

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。