How to View the Execution Order of SQL Execution Plans

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 关于sql执行计划顺序怎么看

| username: zhanggame1

【TiDB Usage Environment】Production Environment / Testing / Poc
【TiDB Version】7.5
【Reproduction Path】What operations were performed when the issue occurred
【Encountered Issue: Issue Phenomenon and Impact】
For example, in the following execution plan, I think TableFullScan_163 is executed first, is that correct?

| username: 小龙虾爱大龙虾 | Original post link

First, execute 179, refer to: TiDB 执行计划概览 | PingCAP 文档中心

| username: zhanggame1 | Original post link

I don’t quite understand this part.

| username: TiDBer_pakki | Original post link

The first to be executed is 179, you can refer to Oracle’s execution plan.

| username: TiDBer_小阿飞 | Original post link

The image you provided is not visible. Please provide the text you need translated.

| username: zhanggame1 | Original post link

Is this the correct understanding:
├─Selection_173(Build)
└─HashJoin_120(Probe)

These two are at the same indentation level, with Build being executed first, so Selection_173(Build) is executed first, and then the most indented TableFullScan_179 is executed.

| username: TiDBer_小阿飞 | Original post link

Build always executes before Probe, with the same level of indentation, first build then probe.

| username: Kongdom | Original post link

:yum: Simply put, it’s from right to left, from bottom to top. It should be noted that some of them are executed in parallel, without any particular order.

| username: 江湖故人 | Original post link

According to Oracle’s principle of executing the rightmost and deepest first, it should be 163 because it is the rightmost and has the deepest indentation.
Personally, I prefer 151. When multiple tables are joined, they are joined two by two. According to the hash join level, 151 is the innermost.

The Oracle client has a similar step-by-step function to view the execution plan order. I wonder if TiDB will release a similar GUI client.

| username: zhanggame1 | Original post link

According to the TiDB manual, it executes concurrently. I thought about converting the execution plan into a binary tree. 179, 163, 151, 154, and 170 are five leaf nodes, which should be able to execute simultaneously, regardless of the order.

| username: 江湖故人 | Original post link

Well, theoretically, concurrent execution in a distributed environment is the most scientific approach.
Oracle might be queuing at the underlying level because most of its execution is local.

| username: 春风十里 | Original post link

I feel that the execution plan is a bit strange. Why is the area I highlighted not aligned?

| username: zhanggame1 | Original post link

It might be a display issue.

| username: TIDB-Learner | Original post link

The execution order of operators

| username: dba远航 | Original post link

For the same level, process from top to bottom; for different levels, process from right to left.

| username: Kongdom | Original post link

It should be an issue with the tool’s UI display.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.