-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
statistics: split lock stats handler and rewrite the insert SQL #46403
statistics: split lock stats handler and rewrite the insert SQL #46403
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #46403 +/- ##
================================================
- Coverage 73.4051% 72.7270% -0.6782%
================================================
Files 1293 1322 +29
Lines 393587 402490 +8903
================================================
+ Hits 288913 292719 +3806
- Misses 86314 91363 +5049
- Partials 18360 18408 +48
Flags with carried forward coverage won't be shown. Click here to find out more.
|
statistics: update SQL statistics: add tests
7b2e3b0
to
f795f29
Compare
create table t(a int, b int);
insert into t values (1,2), (3,4), (5,6), (7,8);
analyze table t;
show warnings;
mysql> show warnings;
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Note | 1105 | Analyze use auto adjusted sample rate 1.000000 for table test.t, reason to use this rate is "use min(1, 110000/4) as the sample-rate=1" |
| Warning | 1105 | skip analyze locked table: t |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from stats_table_locked;
+----------+--------------+-------+--------------------+
| table_id | modify_count | count | version |
+----------+--------------+-------+--------------------+
| 98 | 4 | 4 | 443863948666601483 |
+----------+--------------+-------+--------------------+
1 row in set (0.00 sec)
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> lock stats t;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+-----------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------+
| Warning | 1105 | skip locking locked table: test.t |
+---------+------+-----------------------------------+
1 row in set (0.00 sec) |
Co-authored-by: Yuanjia Zhang <qw4990@163.com>
[LGTM Timeline notifier]Timeline:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, qw4990, time-and-fate 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 |
/retest |
What problem does this PR solve?
Issue Number: ref #46351
Problem Summary:
What is changed and how it works?
AddLockedTables
function to small functions.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.