I am looking for a way to know the number of requests currently running
on my mySQL database.
I found the SHOW FULL PROCESSLIST command displays the list of current
request, but I am looking for a SQL command giving the number of
requests, not the list of the requests.
Is it possible to do in SQL ? Thank you.
If you have the appropriate permissions:
select count(*)
from information_schema.processlist
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Works perfectly, thank you !
There are counters per request type, i.e. COM_UPDATE counts the number
of processed UPDATE statements. Global counters start with 0 when the
server starts. Session counters can be cleared explicitly. RTFM!
> Is it possible to do in SQL ? Thank you.
Counters can be read with SHOW GLOBAL STATUS.
http://dev.mysql.com/doc/refman/5.1/en/show-status.html
XL
as Alvaro said, select count(*) from information_schema.processlist
will give you the number of connections.
If you are looking for only connections that are active, you can do
select count(*) from information_schema.processlist where state != ''