pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.18k stars 5.84k forks source link

the chunk size control can be more elegant #50344

Open winoros opened 9 months ago

winoros commented 9 months ago

Enhancement

image From this explain result, we can see that there's LIMIT which only needs 10 rows. And, yes, the 10 is propagated to the below selection as we can see that it also only reads 10 rows.

But, the 10 is not propagated anymore and the below APPLY uses the default chunk size of 1024. The execution time has increased significantly. And if we set the @@tidb_max_chunk_size to 100, the execution time can be reduced to 300ms.

We may need a more well-maintained chunk size control.

winoros commented 9 months ago

\cc @XuHuaiyu @zanmato1984

winoros commented 9 months ago

Another example for dirty write case. BInsHOyUoJ

seiya-annie commented 4 months ago

/found customer

winoros commented 4 months ago

https://github.com/pingcap/tidb/pull/53855 This pr tried to reduce the RPC. But banned the hacking solution. Need another hack.