INFORMATION_SCHEMA.PROCESSLIST
I requested this urgently for 5.1 and Brian made it happen: An information_schema table called processlist. This is the table version of the "SHOW FULL PROCESSLIST" output, and it is very cool. Using this table, you can create SQL to dig the processlist, and write stored procedures that spot, log and handle long running queries.
Even better: With the new log formats in 5.1, you can access the logs as CSV engine based SQL tables as well, and join the processlist table against the general query log or other logs. This allows you plenty of easy session tracing and easy profiling.
Even better: With the processlist table and 5.1 new feature "events" you can create new threads, monitor their execution, and in case of problems forcibly terminate them using other events or procedures. Or you can write a stored procedure using DROP USER to delete a user, and KILL this users connections afterwards to make sure that guy has been kicked.
The possibilities are endless.
Even better: With the new log formats in 5.1, you can access the logs as CSV engine based SQL tables as well, and join the processlist table against the general query log or other logs. This allows you plenty of easy session tracing and easy profiling.
Even better: With the processlist table and 5.1 new feature "events" you can create new threads, monitor their execution, and in case of problems forcibly terminate them using other events or procedures. Or you can write a stored procedure using DROP USER to delete a user, and KILL this users connections afterwards to make sure that guy has been kicked.
The possibilities are endless.