-
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
*: Hide "Mem" column from SHOW PROCESSSLIST #8543
Conversation
Always shows zero. Column not present in MySQL.
@morgo Will this break the compatibility with MySQL. AFAK, some admin tools rely some specific columns of |
@shenli I've updated the description to make it clearer. 'Mem' is not a column in MySQL - it was a TiDB extension not fully implemented. |
@@ -1504,7 +1504,6 @@ func (s *session) ShowProcess() util.ProcessInfo { | |||
tmp := s.processInfo.Load() | |||
if tmp != nil { | |||
pi = tmp.(util.ProcessInfo) | |||
pi.Mem = s.GetSessionVars().StmtCtx.MemTracker.BytesConsumed() |
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.
The Mem
is not 0 if you run a memory consuming query simultaneously with SHOW PROCESSLIST
. For example:
mysql> SHOW PROCESSLIST;
+------+------+-----------+------+---------+------+-------+-----------------------------------------------------------------+--------+
| Id | User | Host | db | Command | Time | State | Info | Mem |
+------+------+-----------+------+---------+------+-------+-----------------------------------------------------------------+--------+
| 1 | root | 127.0.0.1 | tmp | Query | 0 | 2 | SHOW PROCESSLIST | 0 |
| 2 | root | 127.0.0.1 | tmp | Query | 2 | 2 | insert into tbl select t1.a, t1.b, t1.c from tbl t1 join tbl t2 | 245616 |
+------+------+-----------+------+---------+------+-------+-----------------------------------------------------------------+--------+
2 rows in set (0.02 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.
Interesting it is not accurate for my select
and load data
statements:
mysql> SHOW PROCESSLIST;
+------+------+-----------+-----------+---------+------+-------+------------------------------------------------------------------------------------------------------+------+
| Id | User | Host | db | Command | Time | State | Info | Mem |
+------+------+-----------+-----------+---------+------+-------+------------------------------------------------------------------------------------------------------+------+
| 5 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2011-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED BY | 0 |
| 6 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2012Q4-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
| 4 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2012Q1-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
| 7 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2016Q3-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
| 11 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2013Q3-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
| 9 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2014Q3-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
| 12 | root | 127.0.0.1 | | Query | 53 | 2 | SELECT SLEEP(100) | 0 |
| 13 | root | 127.0.0.1 | bikeshare | Query | 7 | 2 | SELECT * FROM trips WHERE sleep(10)=0 LIMIT 10 | 0 |
| 1 | root | 127.0.0.1 | | Query | 0 | 2 | SHOW PROCESSLIST | 0 |
| 8 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2014Q1-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
| 10 | root | 127.0.0.1 | bikeshare | Query | 153 | 2 | LOAD DATA LOCAL INFILE './2013Q2-capitalbikeshare-tripdata.csv' INTO TABLE trips FIELDS TERMINATED B | 0 |
+------+------+-----------+-----------+---------+------+-------+------------------------------------------------------------------------------------------------------+------+
11 rows in set (0.01 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.
For now, we only trace the memory usage in some memory intensive SQL operators, for example, HashJoin/IndexLookupJoin/IndexLookupReader, etc.
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.
Oh, then I prefer removing this Mem
field since it may confuse users without this knowledge.
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
How to get the values of |
/run-all-tests |
@jackysp When I had written the patch, I thought they were always zero. It turns out there are cases of non-zero :( How about adding an extension |
Glade to see this new feature. 😄 |
/run-integration-ddl-test |
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
What problem does this PR solve?
#8482
What is changed and how it works?
The command
SHOW PROCESSLIST
has a column called 'Mem', which at least for me has always showed a zero value. This patch removes the column completely, but an alternative fix (beyond my current skill) could be to fix the output to be correct.In MySQL the memory info is available in perfschema (try for example:
SELECT * FROM sys.session
) , but since TiDB does not implement perfschema maybe extending processlist is the best way to present it? I could be convinced either way, but I am submitting this patch because a zero value is a bad first experience.MySQL 5.7.40:
TiDB master:
TiDB master + this patch:
Check List
Tests
Ran manual test + fixed tests that broke.
Code changes
Side effects
Related changes
This change is