pingcap / pingcap/tidb

planner: support "explain analyze format='ru'" to show how TiDB calculate RU

Open
#70,373 0 comments 0 reactions 0 assignees View on GitHub
sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

Below is an example, show the user how we calculate RU for each operator and the plan, which can guide the user to optimize the SQL plan and reduce their costs.

Non-correlated sub-queries and the optimizer and parser RU would be cumulated at the root node, and see `TopN_8's` details below:

```
id task actRows selfRU cumRU cumRU% detail
TopN_8 root 20 0.04 84.31 21.9% sub-query: xxx, optimizer: xxx
└─Selection_7 cop[tikv] 12410 3.12 84.27 21.9% ...
└─TableFullScan_6 cop[tikv] 2000000 81.15 81.15 21.1% 2000000 * ... + ...
```

Contributor guide

Open the contributing guide

Research direction

No files or tests are identified in the issue. Start by locating the EXPLAIN ANALYZE FORMAT handling and the existing RU calculation paths, then compare their operator and plan data with the requested output; done means the example-style RU details are shown for each operator and the plan, including sub-query and optimizer costs at the root.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.