The
SHOW PROCESSLIST; command is a quick way to get a snapshot of all active queries running on your server. This command displays each query along with several pieces of key information, including how long each query has been running. Those with a high "Time" value are likely your long-running queries. Here's how you can use this command:
SHOW FULL PROCESSLIST;This command will list all the current processes, show who started them, what type of command they're running, and, crucially, how long they've been at it. If you spot any queries that have been running for an unusually long time, those are your long-running queries. You can then decide whether to dig deeper into optimizing them or simply kill them if they're dragging your system's performance down.