-
Notifications
You must be signed in to change notification settings - Fork 687
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
Add new Index advisor user doc #19867
base: master
Are you sure you want to change the base?
Conversation
@qw4990 Could you please invite a tech reviewer? Thanks! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
||
```sql | ||
mysql> CREATE TABLE t(a int, b int, c int); | ||
mysql> RECOMMEND INDEX RUN for "select a, b from t where a=1 and b=1"; |
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.
Does it command accept "\G" as delimiter? column-style printing improves readability for single output.
mysql> CREATE TABLE t(a int, b int, c int); | ||
mysql> RECOMMEND INDEX RUN for "select a, b from t where a=1 and b=1"; | ||
+----------+-------+------------+---------------+------------+----------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------+ | ||
| database | table | index_name | index_columns | index_size | reason | top_impacted_query | create_index_statement | |
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.
- If "index_size" is not exact value, better to rename it with "est_index_size".
- It's recommended to append meaningful string as suffix of index name, so that we are able to understand it's from index advisor. Name conflict can be avoid as well. For example "idx_..._<trailing 8 chars in plan digest>
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.
index_size is the maximum number of columns an index can have. May be we can rename to reflect that, say "max_index_columns".
+----------+-------+------------+---------------+------------+----------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------+ | ||
| database | table | index_name | index_columns | index_size | reason | top_impacted_query | create_index_statement | | ||
+----------+-------+------------+---------------+------------+----------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------+ | ||
| test | t | idx_a_b | a,b | 19872 | Column [a b] appear in Equal or Range Predicate clause(s) in query: select `a` , `b` from `test` . `t` where `a` = ? and `b` = ? | [{"Query":"SELECT `a`,`b` FROM `test`.`t` WHERE `a` = 1 AND `b` = 1","Improvement":0.999994}] | CREATE INDEX idx_a_b ON t(a,b); | |
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.
We shall explain how we decide "Improvement" later in this section.
|
||
```sql | ||
Recommend Index Set <option> = <value>; | ||
Recommend Index Show; |
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.
Can we make this "Recommend Index Show Options"? We'd better reserve "Recommend Index Show " for future usage.
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.
Agree since it is only used to show options.
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
Co-authored-by: Roger Song <[email protected]>
@qw4990: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
First-time contributors' checklist
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?