MySQL: fetch multiple global status and system variable in a single query

mysql-5.1performancequery-performance

When we execute SHOW global status; or SHOW variables; we get list of 291 and 278 records in the resultset. For performance perspective, only few of them are much important. I have to fetch these variables many times during performance hit.
For example, can we write below multiple statement into one?

show global status like 'Threads_cached';
show global status like 'Threads_connected';
show global status like 'Threads_created';
show global status like 'Threads_running';
show global status like 'Select_scan';

If we fetch these variables in a single statement, it will be really a great help…

Best Answer

select * from information_schema.GLOBAL_STATUS where VARIABLE_NAME like 'Threads_cached' or VARIABLE_NAME like 'Threads_connected' or VARIABLE_NAME like 'Threads_created' or VARIABLE_NAME like 'Threads_running' or VARIABLE_NAME like 'Select_scan';