-
Notifications
You must be signed in to change notification settings - Fork 708
*: add slow log control variables (tidb_slow_log_rules, tidb_slow_log_max_per_sec) and hint WRITE_SLOW_LOG (#22176)
#22517
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
Open
ti-chi-bot
wants to merge
10
commits into
pingcap:release-8.5
Choose a base branch
from
ti-chi-bot:cherry-pick-22176-to-release-8.5
base: release-8.5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4d20c7f
Update identify-slow-queries.md
hfxsd 553afca
initial trans
hfxsd 5e9cc0e
Apply suggestions from code review
hfxsd 84fa585
Update identify-slow-queries.md
hfxsd d2e0d12
Update identify-slow-queries.md
hfxsd eba7645
Update system-variables.md
hfxsd 9e58d68
Update identify-slow-queries.md
hfxsd 0d4ee12
Apply suggestions from code review
hfxsd 1e67e27
Update identify-slow-queries.md
hfxsd 57abec5
Update identify-slow-queries.md
lilin90 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 hidden or 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
This file contains hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5805,6 +5805,32 @@ Query OK, 0 rows affected, 1 warning (0.00 sec) | |||||
| > | ||||||
| > If the character check is skipped, TiDB might fail to detect invalid UTF-8 characters written by the application, cause decoding errors when `ANALYZE` is executed, and introduce other unknown encoding issues. If your application cannot guarantee the validity of the written string, it is not recommended to skip the character check. | ||||||
| ### tidb_slow_log_max_per_sec <span class="version-mark">New in v9.0.0</span> | ||||||
| - Scope: GLOBAL | ||||||
| - Persists to cluster: Yes | ||||||
| - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No | ||||||
| - Default value: `0` | ||||||
| - Type: Integer | ||||||
| - Range: `[0, 1000000]` | ||||||
| - This variable controls the maximum number of slow query log entries that can be written per TiDB node per second. | ||||||
| - A value of `0` means there is no limit on the number of slow query log entries written per second. | ||||||
| - A value greater than `0` means TiDB writes at most the specified number of slow query log entries per second. Any excess log entries are discarded and not written to the slow query log file. | ||||||
| - This variable is often used with [`tidb_slow_log_rules`](#tidb_slow_log_rules-new-in-v900) to prevent excessive slow query logs from being generated under high-workload conditions. | ||||||
| ### tidb_slow_log_rules <span class="version-mark">New in v9.0.0</span> | ||||||
| - Scope: SESSION | GLOBAL | ||||||
| - Persists to cluster: Yes | ||||||
| - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No | ||||||
| - Default value: "" | ||||||
| - Type: String | ||||||
| - This variable defines the triggering rules for slow query logs. It supports combining multi-dimensional metrics to provide more flexible and fine-grained logging. | ||||||
| > **Tip:** | ||||||
| > | ||||||
| > After enabling `tidb_slow_log_rules`, it is recommended to also configure [`tidb_slow_log_max_per_sec`](#tidb_slow_log_max_per_sec-new-in-v900) to limit the slow query log output rate and prevent rule-based slow query logging from being triggered too frequently. | ||||||
|
Contributor
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. To follow the style guide's preference for active voice and direct address, this sentence can be rephrased to be more direct.
Suggested change
|
||||||
| ### tidb_slow_log_threshold | ||||||
| > **Note:** | ||||||
|
|
||||||
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.
To improve readability and maintain correct Markdown formatting, this list item should have the same indentation as the other items at its level. It seems to be a sub-point of 'If
tidb_slow_log_rulesis set'.References