Open guo-shaoge opened 11 months ago
Limit_13
with 5ms). Check hereWhat you see from the explain analyze ...
differs from what you can get from the coprocessor paging layer. @guo-shaoge
Basically you can view our network stack as follows:
distsql layer // request = select DAG / result = chunk result
coprocessor layer // abstract away from requested kv range => specific tikv node (router using region cache)
grpc layer // remote RPC
tcp layer // streaming protocol
...
Each layer has their specific purpose, in coprocessor layer we hide the details of key range request to specific tikv node mapping. And distsql request is one of the application on this layer, where the request type = DAG.
In coprocessor layer, the data is opaque, it's a []byte. The upper layer, i.e. distsql layer is responsible for decoding it. Explan analyze works on the upper layer, it decode the data to get the time cost of each operators.
So we cannot get the time cost of each operator to decide whether or not cache one coprocessor result. That information is unavailable:
The coprocessor logic compare the execution time of index scan with 5ms to see if the copr resp can insert into copr cache.(which is wrong, because we should check the execution time of Limit_13 with 5ms). Check here
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
copr cache always hit
3. What did you see instead (Required)
copr cache not hit when paging is enabled:
and copr cache is hit when paging is disabled:
4. What is your TiDB version? (Required)