MySQL in action: choosing an execution plan based on cost

insert image description here
The cost is divided into 2 blocks
IO cost: read data from disk to memory, the cost value is agreed to be 1.0
CPU cost: check whether the record meets the search conditions, sort the result set, etc., the cost value is agreed to be 0.2

IO cost: number of data pages * 1.0 + fine-tuning value
CPU cost: number of row records * 0.2 + fine-tuning value

Reference blog

[1]https://juejin.cn/book/6844733769996304392/section/6844733770055024647

Guess you like

Origin blog.csdn.net/zzti_erlie/article/details/123739007