Digital Marketing

MySQL how to get non sleep processlist

$ mysqladmin --login-path=root processlist | grep -v 'Sleep' | less

Get only process ids:
$ mysqladmin --login-path=root processlist | grep -v 'Sleep'  | awk -F '|' '{print $2}'
Others:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where command !='Sleep';
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where command !='Sleep' and STATE != 'Waiting for table metadata lock';
SELECT count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where STATE = 'Waiting for table metadata lock';

Comments

Popular posts from this blog

Make online money from the Internet