You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
droptable if exists t;
createtablet (id int key auto_increment, b int, c int, index idx (b));
insert into t () values (), (), (), (), (), (), (), ();
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t;
insert into t (b) select b from t limit34464;
update t set b = rand() *1000000 ;
split table t between (0) and (100000) regions 100;
set @@tidb_store_batch_size=0; -- disable store batch, to make the issue more clearer.
explain analyze select*from t use index(idx) where b >=0and b <200000;
You can see the execution information of TableRowIDScan_6 executor as following, it send less cop rpc and total rpc time is less, which also means consumes less resources.
Enhancement
1. Minimal reproduce step
Pay attention to the execution information of
TableRowIDScan_6
executor:The table
t
only has 100 regions, but theTableRowIDScan
executor sends a total of 500 cop requests, It's too wasteful (consuming) resources.But, if set
tidb_max_chunk_size=20000
, we can fix this:You can see the execution information of
TableRowIDScan_6
executor as following, it send less cop rpc and total rpc time is less, which also means consumes less resources.Can we try to automatically adjust
tidb_max_chunk_size
or something else to optimize this issue?2. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: