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

*: add executor runtime info for explain for connection statement #19183

Merged
merged 8 commits into from
Sep 27, 2020

Conversation

hesper-guo
Copy link
Contributor

@hesper-guo hesper-guo commented Aug 13, 2020

What problem does this PR solve?

Issue Number: close #18233

Problem Summary:
add this runtime information in explain for connection statement.

Example:

When set @@tidb_enable_collect_execution_info=1;

test> show processlist;
+-----+------+-----------+------+---------+------+------------+-----------------------------------------------------------+
| Id  | User | Host      | db   | Command | Time | State      | Info                                                      |
+-----+------+-----------+------+---------+------+------------+-----------------------------------------------------------+
| 775 | root | 127.0.0.1 | test | Query   | 65   | autocommit | select count(*) from t1 tt1 join t1 tt2 where tt1.a>tt2.a |
| 1   | root | 127.0.0.1 | test | Query   | 0    | autocommit | show processlist                                          |
+-----+------+-----------+------+---------+------+------------+-----------------------------------------------------------+
test> explain for connection 775;
+---------------------------+-------------+---------+-----------+-----------------------+----------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+--------+------+
| id                        | estRows     | actRows | task      | access object         | execution info                                                                                                       | operator info                                             | memory | disk |
+---------------------------+-------------+---------+-----------+-----------------------+----------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+--------+------+
| HashAgg_11                | 1.00        | 0       | root      |                       | time:0s, loops:0                                                                                                     | funcs:count(1)->Column#7                                  | N/A    | N/A  |
| └─HashJoin_14             | 99800100.00 | 1083392 | root      |                       | time:11.67287184s, loops:1058                                                                                        | CARTESIAN inner join, other cond:gt(test.t1.a, test.t1.a) | N/A    | N/A  |
|   ├─IndexReader_19(Build) | 9990.00     | 482836  | root      |                       | time:138.962375ms, loops:473, cop_task: {num: 1, max:125.755703ms, proc_keys: 0, rpc_num: 1, rpc_time: 125.729723ms} | index:IndexFullScan_18                                    | N/A    | N/A  |
|   │ └─IndexFullScan_18    | 9990.00     | 0       | cop[tikv] | table:tt2, index:a(a) | time:0ns, loops:0                                                                                                    | keep order:false, stats:pseudo                            | N/A    | N/A  |
|   └─IndexReader_17(Probe) | 9990.00     | 5120    | root      |                       | time:126.260071ms, loops:5, cop_task: {num: 1, max:125.596953ms, proc_keys: 0, rpc_num: 1, rpc_time: 125.582473ms}   | index:IndexFullScan_16                                    | N/A    | N/A  |
|     └─IndexFullScan_16    | 9990.00     | 0       | cop[tikv] | table:tt1, index:a(a) | time:0ns, loops:0                                                                                                    | keep order:false, stats:pseudo                            | N/A    | N/A  |
+---------------------------+-------------+---------+-----------+-----------------------+----------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+--------+------+

# after a while
test> explain for connection 775;
+---------------------------+-------------+-----------+-----------+-----------------------+----------------------------------------------------------------------------------+-----------------------------------------------------------+--------+------+
| id                        | estRows     | actRows   | task      | access object         | execution info                                                                   | operator info                                             | memory | disk |
+---------------------------+-------------+-----------+-----------+-----------------------+----------------------------------------------------------------------------------+-----------------------------------------------------------+--------+------+
| HashAgg_11                | 1.00        | 0         | root      |                       | time:0s, loops:0                                                                 | funcs:count(1)->Column#7                                  | N/A    | N/A  |
| └─HashJoin_14             | 99800100.00 | 145286144 | root      |                       | time:6m3.062011395s, loops:141881                                                | CARTESIAN inner join, other cond:gt(test.t1.a, test.t1.a) | N/A    | N/A  |
|   ├─IndexReader_19(Build) | 9990.00     | 482836    | root      |                       | time:138.962375ms, loops:473, cop_task: {num: 1, max:125.755703ms, proc_keys: 0} | index:IndexFullScan_18                                    | N/A    | N/A  |
|   │ └─IndexFullScan_18    | 9990.00     | 0         | cop[tikv] | table:tt2, index:a(a) | time:0ns, loops:0                                                                | keep order:false, stats:pseudo                            | N/A    | N/A  |
|   └─IndexReader_17(Probe) | 9990.00     | 19456     | root      |                       | time:127.068821ms, loops:19, cop_task: {num: 1, max:125.596953ms, proc_keys: 0}  | index:IndexFullScan_16                                    | N/A    | N/A  |
|     └─IndexFullScan_16    | 9990.00     | 0         | cop[tikv] | table:tt1, index:a(a) | time:0ns, loops:0                                                                | keep order:false, stats:pseudo                            | N/A    | N/A  |
+---------------------------+-------------+-----------+-----------+-----------------------+----------------------------------------------------------------------------------+-----------------------------------------------------------+--------+------+

When set @@tidb_enable_collect_execution_info=0;, Since TiDB doesn't collect runtime information, so explan for connection will also not display the executor info.

explain for connection 778;
+---------------------------+-----------------+-----------+-----------------------+-----------------------------------------------------------+
| id                        | estRows         | task      | access object         | operator info                                             |
+---------------------------+-----------------+-----------+-----------------------+-----------------------------------------------------------+
| HashAgg_11                | 1.00            | root      |                       | funcs:count(1)->Column#7                                  |
| └─HashJoin_14             | 233130602896.00 | root      |                       | CARTESIAN inner join, other cond:gt(test.t1.a, test.t1.a) |
|   ├─IndexReader_19(Build) | 482836.00       | root      |                       | index:IndexFullScan_18                                    |
|   │ └─IndexFullScan_18    | 482836.00       | cop[tikv] | table:tt2, index:a(a) | keep order:false                                          |
|   └─IndexReader_17(Probe) | 482836.00       | root      |                       | index:IndexFullScan_16                                    |
|     └─IndexFullScan_16    | 482836.00       | cop[tikv] | table:tt1, index:a(a) | keep order:false                                          |
+---------------------------+-----------------+-----------+-----------------------+-----------------------------------------------------------+

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • Add executor information in explain for connection result.

@hesper-guo hesper-guo requested a review from a team as a code owner August 13, 2020 10:42
@hesper-guo hesper-guo requested review from SunRunAway and removed request for a team August 13, 2020 10:42
@ti-srebot ti-srebot added the contribution This PR is from a community contributor. label Aug 13, 2020
@CLAassistant
Copy link

CLAassistant commented Aug 13, 2020

CLA assistant check
All committers have signed the CLA.

@hesper-guo hesper-guo changed the title My branch Add executor runtime info for explain for connection statement Aug 13, 2020
@crazycs520 crazycs520 self-requested a review August 18, 2020 03:33
@pingcap pingcap deleted a comment from sre-bot Aug 20, 2020
@pingcap pingcap deleted a comment from sre-bot Aug 20, 2020
@qw4990 qw4990 self-requested a review August 21, 2020 03:31
@sre-bot
Copy link
Contributor

sre-bot commented Sep 8, 2020

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what's changed

  • *: what's changed

@crazycs520 crazycs520 changed the title Add executor runtime info for explain for connection statement *: add executor runtime info for explain for connection statement Sep 8, 2020
@crazycs520
Copy link
Contributor

@qw4990 PTAL

@hesper-guo hesper-guo requested a review from a team as a code owner September 10, 2020 03:32
@github-actions github-actions bot added the sig/execution SIG execution label Sep 10, 2020
@crazycs520
Copy link
Contributor

/run-all-tests

planner/core/encode.go Outdated Show resolved Hide resolved
@SunRunAway SunRunAway requested review from lzmhhh123 and removed request for SunRunAway September 22, 2020 08:31
qw4990
qw4990 previously approved these changes Sep 23, 2020
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
@crazycs520
Copy link
Contributor

/run-all-tests

1 similar comment
@crazycs520
Copy link
Contributor

/run-all-tests

@crazycs520
Copy link
Contributor

/run-unit-test

@crazycs520
Copy link
Contributor

/run-all-tests

@crazycs520
Copy link
Contributor

/rebuild

@crazycs520
Copy link
Contributor

/run-all-tests

@crazycs520
Copy link
Contributor

/run-all-tests

1 similar comment
@crazycs520
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot removed the status/LGT2 Indicates that a PR has LGTM 2. label Sep 27, 2020
@ti-srebot ti-srebot added the status/LGT3 The PR has already had 3 LGTM. label Sep 27, 2020
@crazycs520 crazycs520 merged commit 17b7b5e into pingcap:master Sep 27, 2020
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Oct 10, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #20384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add executor runtime info for explain for connection statement
8 participants