SQL to receive a count of all tasks that are in a pending state without workflow. SQL provides the number of tasks stuck In-Progress.
There can be different causes of tasks getting stuck in an In-Progress state. Please see the follow In-Progress troubleshooting guide:
IN-PROGRESS task issues - A Client’s Guide to Understanding and Resolving
SELECT tasksession12_5.tasksessionid, tasksession12_5.state, event12_5.eventid, event12_5.state FROM tasksession12_5 INNER JOIN event12_5 ON event12_5.tasksessionid=tasksession12_5.tasksessionid
WHERE ((tasksession12_5.state != '512') AND (tasksession12_5.state != '128') AND (tasksession12_5.state != '256') AND (tasksession12_5.state != '32') AND (tasksession12_5.state != '2') AND (tasksession12_5.state != '1048576') AND (tasksession12_5.state != '4') AND (tasksession12_5.state != '2048') AND (tasksession12_5.state != '8192') AND (tasksession12_5.state != '16384') AND (event12_5.state in ('128','256','32','2','1048576','4'))) ;