pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.4k stars 5.73k forks source link

infoschema, util/stmtsummary: enhance statements_summary. #25031

Closed ClSlaid closed 3 years ago

ClSlaid commented 3 years ago

What problem does this PR solve?

Issue Number: close #24083

Problem Summary:

What is changed and how it works?

What's Changed:

before:

select * from `INFORMATION_SCHEMA`.`STATEMENTS_SUMMARY`;

output:

BEGIN_TIME ... DIGEST SCHEMA_NAME ...
2019-01-01 00:30 ... digest_2 schema_name_2 ...
2019-01-01 00:30 ... digest_1 schema_name_1 ...
2019-01-01 00:00 ... digest_0 schema_name_0 ...

statement_summary table has a fixed size, some statement digests may get kicked by other digests, leading to lose of information.

This pull request will append a special row to the statement_summary, which would sum up those statement digests got evicted from statement_summary, so that all digests' information will be recorded.

Following MySQL's behavior, the row's DIGEST and SCHEMA_NAME match no record in the table, their value is <nil>.

BEGIN_TIME ... DIGEST SCHEMA_NAME ...
2019-01-01 00:30 ... digest_2 schema_name_2 ...
2019-01-01 00:30 ... digest_1 schema_name_1 ...
2019-01-01 00:00 ... digest_0 schema_name_0 ...
2019-01-01 00:30 ... <nil> <nil> ...

Special rows corresponding to each interval will also be append to statements_summary_history table.

How it Works:

Related changes

Check List

Tests

Side effects

Release note

ClSlaid commented 3 years ago

/run-check_dev_2

ClSlaid commented 3 years ago

/cc @crazycs520 PTAL.

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-check_dev_2

ClSlaid commented 3 years ago

/cc @crazycs520

crazycs520 commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-check_dev_2

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-intergration-common-test

ClSlaid commented 3 years ago

/run-integration-common-test

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-check_dev_2 /run-intergration-common-test

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

crazycs520 commented 3 years ago

@breeswish @djshow832 PTAL

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-integration-common-test

ClSlaid commented 3 years ago

/run-check_dev_2 /run-integration-br-test

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-check_dev_2 /run-unit-test

breezewish commented 3 years ago

Should we cherry pick this into v4.0.x?

crazycs520 commented 3 years ago

Should we cherry pick this into v4.0.x?

Since this is not a bug fix, I'm afraid it's hard to cherry-pick into v4.0.

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-common-test

ClSlaid commented 3 years ago

/run-integration-br-test

ClSlaid commented 3 years ago

/run-integration-br-test

ClSlaid commented 3 years ago

/run-check_dev_2

ClSlaid commented 3 years ago

/run-check_dev_2

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-check_dev_2

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-integration-br-test

ClSlaid commented 3 years ago

/run-integration-br-test /run-check_dev_2

ClSlaid commented 3 years ago

/run-integration-br-test

ClSlaid commented 3 years ago

/run-all-tests

ClSlaid commented 3 years ago

/run-all-tests

ti-chi-bot commented 3 years ago

[REVIEW NOTIFICATION]

This pull request has been approved by:

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.
djshow832 commented 3 years ago

/merge