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

sessionctx: add some information about the rewriting phase into the slow log #17569

Merged
merged 9 commits into from
Jun 9, 2020

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented Jun 1, 2020

What problem does this PR solve?

Issue Number: #17557

Problem Summary: add some information about the rewriting phase into the slow log

What is changed and how it works?

One step to resolve #17557.
Add three fields to slow logs:

  1. Rewrite_time: the time cost to rewrite the query;
  2. Preprocessed_subqueries: the number of pre-processed subqueries;
  3. Preprocessed_subquery_time: the total time of pre-processing subqueries.

For example, in this query:

select * from t where a > (select min(a+sleep(1)) from t t2 where t2.a<5);

The subquery is not related with the outside query so it will be processed during the rewriting phase.
After this PR, you can see this information in its slow log:

# Rewrite_time: 3.00518165 Preproc_subqueries: 1 Preproc_subqueries_time: 3.004869107

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn: update the relative docs about the slow query.

Check List

Tests

  • Unit test

Release note

  • Add some information about the rewriting phase into the slow log

@github-actions github-actions bot added sig/execution SIG execution sig/planner SIG: Planner labels Jun 1, 2020
@codecov
Copy link

codecov bot commented Jun 1, 2020

Codecov Report

Merging #17569 into master will decrease coverage by 0.0041%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #17569        +/-   ##
================================================
- Coverage   79.5690%   79.5649%   -0.0042%     
================================================
  Files           524        524                
  Lines        142250     142182        -68     
================================================
- Hits         113187     113127        -60     
- Misses        19968      19987        +19     
+ Partials       9095       9068        -27     

@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Jun 8, 2020
Copy link
Contributor

@Reminiscent Reminiscent left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM,
Remember to update the docs.

@qw4990
Copy link
Contributor Author

qw4990 commented Jun 9, 2020

LGTM,
Remember to update the docs.

Ok, thx.

@qw4990 qw4990 added status/can-merge Indicates a PR has been approved by a committer. and removed status/PTAL labels Jun 9, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jun 9, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Jun 9, 2020

@qw4990 merge failed.

@qw4990
Copy link
Contributor Author

qw4990 commented Jun 9, 2020

/run-all-tests

1 similar comment
@qw4990
Copy link
Contributor Author

qw4990 commented Jun 9, 2020

/run-all-tests

@qw4990 qw4990 merged commit 0ec197f into pingcap:master Jun 9, 2020
@breezewish
Copy link
Member

#17557 need to be re-opened :)

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jun 22, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #18164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/session sig/execution SIG execution sig/planner SIG: Planner sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more information in slow logs to help analyze slow queries
6 participants