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

show the correct number of threads of agg in explain analyze #5367

Closed
wants to merge 3 commits into from

Conversation

SeaRise
Copy link
Contributor

@SeaRise SeaRise commented Jul 14, 2022

What problem does this PR solve?

Issue Number: close #5314

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Show the correct number of threads of agg in explain analyze.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 14, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • ywqzzy

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jul 14, 2022
@SeaRise
Copy link
Contributor Author

SeaRise commented Jul 14, 2022

+----------------------------------+---------+---------+--------------+---------------+--------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+--------+------+
| id                               | estRows | actRows | task         | access object | execution info                                                                             | operator info                                                                                                            | memory | disk |
+----------------------------------+---------+---------+--------------+---------------+--------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+--------+------+
| TableReader_24                   | 12.00   | 5       | root         |               | time:1.44s, loops:2, cop_task: {num: 1, max: 0s, proc_keys: 0, copr_cache_hit_ratio: 0.00} | data:ExchangeSender_23                                                                                                   | N/A    | N/A  |
| └─ExchangeSender_23              | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:1.25s, loops:1, threads:20}                                             | ExchangeType: PassThrough                                                                                                | N/A    | N/A  |
|   └─Projection_22                | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:1.25s, loops:1, threads:20}                                             | Column#7                                                                                                                 | N/A    | N/A  |
|     └─HashAgg_8                  | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:1.24s, loops:1, threads:20}                                             | group by:test.test.col1, test.test.col3, funcs:count(1)->Column#7                                                        | N/A    | N/A  |
|       └─ExchangeReceiver_21      | 15.00   | 15      | mpp[tiflash] |               | tiflash_task:{time:1.24s, loops:1, threads:20}                                             |                                                                                                                          | N/A    | N/A  |
|         └─ExchangeSender_20      | 15.00   | 15      | mpp[tiflash] |               | tiflash_task:{time:1.24s, loops:1, threads:1}                                              | ExchangeType: HashPartition, Hash Cols: [name: test.test.col1, collate: binary], [name: test.test.col3, collate: binary] | N/A    | N/A  |
|           └─TableFullScan_19     | 15.00   | 15      | mpp[tiflash] | table:test    | tiflash_task:{time:1.24s, loops:1, threads:1}                                              | keep order:false, stats:pseudo                                                                                           | N/A    | N/A  |
+----------------------------------+---------+---------+--------------+---------------+--------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+--------+------+

@SeaRise SeaRise requested review from JaySon-Huang and ywqzzy July 14, 2022 07:04
@SeaRise
Copy link
Contributor Author

SeaRise commented Jul 14, 2022

/run-all-tests

@SeaRise
Copy link
Contributor Author

SeaRise commented Jul 14, 2022

/check-issue-triage-complete

dbms/src/Flash/Statistics/ExecutorStatistics.h Outdated Show resolved Hide resolved
Comment on lines +460 to +462
/// We consider the number of streams as the concurrency of the operator and pass it to tidb.
for (size_t i = 1; i < concurrency; ++i)
profile_streams.emplace_back(std::make_shared<NullBlockInputStream>(header));
Copy link
Contributor

@JaySon-Huang JaySon-Huang Jul 14, 2022

Choose a reason for hiding this comment

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

Do we fill the concurrency to the response in here?

/// part 1: local execution info
for (const auto & stream_ptr : streams)
{
if (auto * p_stream = dynamic_cast<IProfilingBlockInputStream *>(stream_ptr.get()))
{
current.time_processed_ns = std::max(current.time_processed_ns, p_stream->getProfileInfo().execution_time);
current.num_produced_rows += p_stream->getProfileInfo().rows;
current.num_iterations += p_stream->getProfileInfo().blocks;
}
current.concurrency++;

I don't get it that why using NullBlockInputStream here won't affect the number of actual rows, actual process time, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because NullBlockInputStream is not IProfilingBlockInputStream..

@sre-bot
Copy link
Collaborator

sre-bot commented Jul 14, 2022

Coverage for changed files

Filename                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Coprocessor/DAGQueryBlockInterpreter.cpp         259                90    65.25%          34                 5    85.29%         607               156    74.30%         164                60    63.41%
Coprocessor/DAGQueryBlockInterpreter.h             2                 0   100.00%           2                 0   100.00%           2                 0   100.00%           0                 0         -
Statistics/ExecutorStatistics.h                   17                17     0.00%           8                 8     0.00%          63                63     0.00%           6                 6     0.00%
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                            278               107    61.51%          44                13    70.45%         672               219    67.41%         170                66    61.18%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18529      9572             48.34%    208802  96359        53.85%

full coverage report (for internal network access only)

@SeaRise
Copy link
Contributor Author

SeaRise commented Jul 19, 2022

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 19, 2022
Copy link
Contributor

@ywqzzy ywqzzy 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-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 22, 2022
@SeaRise
Copy link
Contributor Author

SeaRise commented Aug 8, 2022

will fixed by #5321

@SeaRise SeaRise closed this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The number of threads of agg in explain analyze is not correct
5 participants