# Batch Size
+ One Chunk contains multiple rows. When a SQL statement is executed, executor will perform all the operator by a chuck unit, such as getting data/evaluating expression/join etc... When the result set is large, then a big chuck size will improve performance, however, when the result set is small, lots of memory requested by chunk will cause performance downgrade.

![center](./student-guide/diagram/06-batch-size-01-01.png)
-------------------------------------------------------------
Batch size
- A chunk contains multiple row of data. When an SQL statement is executed, the executor performs data acquisition, expression evaluation, and JOIN operations in chunk units. When the result set is large, a larger chunk size can improve performance. If the result set is small, less than the chunk size, the memory of an oversized chunk will be requested. Causing a loss of performance
- tidb_init_chunk_size/tidb_max_chunk_size
  - When an operator is executed, a chunk of tidb_init_chunk_size is created for the first time. When the result set is larger than the initial chunk size, the chunk size will be scale out the next time it is executed, and the size of the chunk size will be increased. If the result set still exceeds the chunk size, it will be expanded again. capacity until the upper limit set by tidb_max_chunk_size is reached
- tidb_index_join_batch_size
  - Control the amount of data processed by the index join operator in a batch. Setting a larger size may improve performance at the cost of consuming more memory
