-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner: include both indexes and columns in job info #54336
planner: include both indexes and columns in job info #54336
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54336 +/- ##
=================================================
- Coverage 72.8839% 56.2625% -16.6214%
=================================================
Files 1533 1654 +121
Lines 436132 611098 +174966
=================================================
+ Hits 317870 343819 +25949
- Misses 98667 243782 +145115
- Partials 19595 23497 +3902
Flags with carried forward coverage won't be shown. Click here to find out more.
|
4992066
to
ac982d0
Compare
Tested locally:
mysql> create table t (a int, b int, c int);
Query OK, 0 rows affected (0.08 sec)
mysql> set global tidb_analyze_column_options='PREDICATE';
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t values (1, 1, 1), (2, 2, 2), (3, 3, 3);
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from mysql.stats_meta;
+--------------------+----------+--------------+-------+----------+
| version | table_id | modify_count | count | snapshot |
+--------------------+----------+--------------+-------+----------+
| 450840965863178242 | 104 | 3 | 3 | 0 |
+--------------------+----------+--------------+-------+----------+
1 row in set (0.00 sec)
mysql> analyze table t;
Query OK, 0 rows affected, 2 warnings (0.05 sec)
mysql> select table_name, job_info from mysql.analyze_jobs;
+------------+--------------------------------------------------------+
| table_name | job_info |
+------------+--------------------------------------------------------+
| t | analyze table with 256 buckets, 100 topn, 1 samplerate |
+------------+--------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from mysql.stats_meta;
+--------------------+----------+--------------+-------+--------------------+
| version | table_id | modify_count | count | snapshot |
+--------------------+----------+--------------+-------+--------------------+
| 450840975760424971 | 104 | 0 | 3 | 450840975747317761 |
+--------------------+----------+--------------+-------+--------------------+
1 row in set (0.00 sec) |
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.
🔢 Self-check (PR reviewed by myself and ready for feedback.)
/retest |
@@ -175,7 +175,7 @@ func TestAnalyzeTableWithTiDBPersistAnalyzeOptionsDisabled(t *testing.T) { | |||
// Analyze again, it should use the predicate columns. | |||
tk.MustExec("analyze table t") | |||
tk.MustQuery("select table_name, job_info from mysql.analyze_jobs order by id desc limit 1").Check( | |||
testkit.Rows("t analyze table columns a with 256 buckets, 100 topn, 1 samplerate"), | |||
testkit.Rows("t analyze table column a with 256 buckets, 100 topn, 1 samplerate"), |
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.
Why not columns in here ? It seems that t table has two columns
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.
Because we only analyze predicate columns here. We only used column a
above.
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: elsa0520, hawkingrei The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/retest |
3 similar comments
/retest |
/retest |
/retest |
/test all |
|
f6825b9
to
30d818b
Compare
/retest |
3 similar comments
/retest |
/retest |
/retest |
What problem does this PR solve?
Issue Number: ref #53567
Problem Summary:
We display
job_info
in themysql.analyze_jobs
table. But we didn't include the indexes information in this column. We need to make it clearer after introducing the predicate columns feature because, by default, we only analyze the index if there are no predicate columns.What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.