Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: add runtime information for DML statement in explain analyze #19106

Merged
merged 29 commits into from
Oct 10, 2020

Conversation

jianyilyu
Copy link
Contributor

@jianyilyu jianyilyu commented Aug 10, 2020

What problem does this PR solve?

Issue Number: close #18056

Problem Summary:

What is changed and how it works?

When insert:
mysql>explain analyze insert ignore into s values (1,1),(2,2),(3,3),(4,4);

+----------+-----------+-----------+--------+-----------------+-------------------------------------------------------------------+-----------------+-----------+--------+
| id       | estRows   |   actRows | task   | access object   | execution info                                                    | operator info   | memory    | disk   |
|----------+-----------+-----------+--------+-----------------+-------------------------------------------------------------------+-----------------+-----------+--------|
| Insert_1 | N/A       |         0 | root   |                 | time:449.777µs, loops:1, BatchGet:{num_rpc:1, total_time:86.28µs} | N/A             | 852 Bytes | N/A    |
+----------+-----------+-----------+--------+-----------------+-------------------------------------------------------------------+-----------------+-----------+--------+
1 row in set
Time: 0.013s

when update:
mysql> explain analyze delete from s where a<24;

+-----------------------+-----------+-----------+-----------+-----------------+----------------------------------------------------------------------+--------------------------------+-----------+--------+
| id                    | estRows   |   actRows | task      | access object   | execution info                                                       | operator info                  | memory    | disk   |
|-----------------------+-----------+-----------+-----------+-----------------+----------------------------------------------------------------------+--------------------------------+-----------+--------|
| Delete_4              | N/A       |         0 | root      |                 | time:485.032µs, loops:1                                              | N/A                            | 0 Bytes   | N/A    |
| └─TableReader_8       | 11.96     |         0 | root      |                 | time:469.505µs, loops:1, rpc num: 1, rpc time:314.474µs, proc keys:0 | data:Selection_7               | 135 Bytes | N/A    |
|   └─Selection_7       | 11.96     |         0 | cop[tikv] |                 | time:0ns, loops:0                                                    | lt(test.s.a, 24)               | N/A       | N/A    |
|     └─TableFullScan_6 | 36.00     |         0 | cop[tikv] | table:s         | time:0ns, loops:0                                                    | keep order:false, stats:pseudo | N/A       | N/A    |
+-----------------------+-----------+-----------+-----------+-----------------+----------------------------------------------------------------------+--------------------------------+-----------+--------+
4 rows in set
Time: 0.018s

when delete:
mysql> explain analyze update s set a=a+10 where a>0;

+-----------------------+-----------+-----------+-----------+-----------------+----------------------------------------------------------------------+--------------------------------+-----------+--------+
| id                    | estRows   |   actRows | task      | access object   | execution info                                                       | operator info                  | memory    | disk   |
|-----------------------+-----------+-----------+-----------+-----------------+----------------------------------------------------------------------+--------------------------------+-----------+--------|
| Update_4              | N/A       |         0 | root      |                 | time:818.134µs, loops:1                                              | N/A                            | 0 Bytes   | N/A    |
| └─TableReader_8       | 12.00     |         0 | root      |                 | time:799.696µs, loops:1, rpc num: 1, rpc time:338.831µs, proc keys:0 | data:Selection_7               | 135 Bytes | N/A    |
|   └─Selection_7       | 12.00     |         0 | cop[tikv] |                 | time:0ns, loops:0                                                    | gt(test.s.a, 0)                | N/A       | N/A    |
|     └─TableFullScan_6 | 36.00     |         0 | cop[tikv] | table:s         | time:0ns, loops:0                                                    | keep order:false, stats:pseudo | N/A       | N/A    |
+-----------------------+-----------+-----------+-----------+-----------------+----------------------------------------------------------------------+--------------------------------+-----------+--------+
4 rows in set
Time: 0.030s

What's Changed:

How it Works:

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Integration test
  • Manual test

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM

Release note

  • Fix up displaying executor runtime info & Add runtime information for DML in explain analyze

@jianyilyu jianyilyu requested review from a team as code owners August 10, 2020 12:55
@jianyilyu jianyilyu requested review from qw4990 and winoros and removed request for a team August 10, 2020 12:55
@ti-srebot ti-srebot added the contribution This PR is from a community contributor. label Aug 10, 2020
@CLAassistant
Copy link

CLAassistant commented Aug 10, 2020

CLA assistant check
All committers have signed the CLA.

@sre-bot
Copy link
Contributor

sre-bot commented Aug 10, 2020

@jianyilyu jianyilyu changed the title #18056 Add runtime information for DML and PointGet in explain analyze and slow logs #18056 Aug 10, 2020
Signed-off-by: jianyilyu <jianyilyu@126.com>
Signed-off-by: jianyilyu <jianyilyu@126.com>
Signed-off-by: jianyilyu <jianyilyu@126.com>
Signed-off-by: jianyilyu <jianyilyu@126.com>
@crazycs520 crazycs520 changed the title Add runtime information for DML and PointGet in explain analyze and slow logs #18056 Add runtime information for DML and PointGet in explain analyze and slow logs Aug 12, 2020
@crazycs520 crazycs520 changed the title Add runtime information for DML and PointGet in explain analyze and slow logs Add runtime information for DML in explain analyze and slow logs Aug 12, 2020
@crazycs520
Copy link
Contributor

/run-all-tests

@crazycs520
Copy link
Contributor

/run-unit-test

@crazycs520
Copy link
Contributor

@qw4990 @SunRunAway PTAL

executor/adapter.go Outdated Show resolved Hide resolved
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 23, 2020
Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Sep 25, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Sep 25, 2020
@crazycs520
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #21066

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program component/executor contribution This PR is from a community contributor. sig/execution SIG execution status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explain analyze support DML statement
8 participants