Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 执行计划算子
When looking at the execution plan, there are some parts that I don’t quite understand.
- What does the operator Projection_63 represent?
Is the interpretation process for this part as follows:
- Execute IndexRangeScan_52 first,
- Then execute Selection_54 (Build),
- Execute TableRowIDScan_53,
- Execute Selection_55 (Probe),
- Combine the results of the first and third steps?
Official 302 course mnemonic: From right to left, from top to bottom
After reading this mnemonic, I still find it a bit difficult to use. Based on my understanding, it should be 52 —> 54, then execute 53 —> 55. However, looking at the sequence numbers, it doesn’t quite match…
According to the understanding, it should be 52 —> 54, then execute 53 —> 55, but looking at the sequence numbers, it doesn’t quite match…
Your understanding is correct, it’s just a matter of numbering.
From right to left, from top to bottom.
Looking from top to bottom, 56 is the rightmost and has no peer operator, so 56 starts executing. 54 and 55 are indented the same to the right, so 54 goes first. Within operator 54, 52 is to the right, so 52 executes first. After the first level of 54 is done, it’s 55’s turn, and 53, being to the right, goes first.
The ID doesn’t follow any specific pattern as long as it is unique. However, when generating the execution plan, there is a counter that increments by 1 after generating a plan ID. The execution order is not related to the sequence number. The entire execution plan is a tree, and execution starts from the root node, continuously returning data upwards.
SQL Operation FAQs | PingCAP Docs