-
Notifications
You must be signed in to change notification settings - Fork 677
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
sql: update slow query document #663
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,3 +95,25 @@ The SQL statement. | |
Not all of the `SLOW_QUERY` statements are problematic. Only those whose `process_time` is very large will increase the pressure on the entire cluster. | ||
|
||
The statements whose `wait_time` is very large and `process_time` is very small are usually not problematic. The large `wait_time` is because the statement is blocked by real problematic statements and it has to wait in the execution queue, which leads to a much longer response time. | ||
|
||
### `admin show slow` command | ||
|
||
Besides obtaining the TiDB log file, another way to identify the slow query is through the `admin show slow` SQL command: | ||
|
||
admin show slow recent N | ||
admin show slow top [internal | all] N | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For code blocks and the following part, please refer to my comments here: pingcap/docs-cn#922 |
||
|
||
`recent N` shows the recent N slow query records, for example: | ||
|
||
admin show recent 10 | ||
|
||
`top N` shows the slowest N query records recently (within a few days). | ||
If the `internal` option is provided, the returned results would be the inner SQL executed by the system; | ||
If the `all` option is provided, the returned results would be the user's SQL combinated with inner SQL; | ||
Otherwise, this command would only return the slow query records from the user's SQL. | ||
|
||
admin show top 3 | ||
admin show top internal 3 | ||
admin show top all 5 | ||
|
||
Due to the memory footprint restriction, the stored slow query records count is limited. If the specified `N` is greater than the records count, the returned records count may be smaller than `N`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I suggest: "In addition to the TIDB log file, you can identify slow queries by running the
admin show slow
."besides could implies it is an either/or, but there is a use case for both.