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) #21066

Merged
merged 3 commits into from
Nov 16, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #19106 to release-4.0


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

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot you're already a collaborator in bot's repo.

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520
Copy link
Contributor

/run-all-tests

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 Nov 16, 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 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 16, 2020
@SunRunAway
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 16, 2020
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@SunRunAway
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Nov 16, 2020
@crazycs520
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@crazycs520 crazycs520 self-assigned this Nov 16, 2020
@ti-srebot ti-srebot merged commit 1337d34 into pingcap:release-4.0 Nov 16, 2020
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/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants