PHP script that scans for a period of time the queries that are executed (MySQL, MariaDB), showing graphically the results, can be used to detect slow queries, that produce a blockage or simply to optimize.
Configure the file to connect to your database.
You can use this script by running it from a browser or from the command line.
php ./queryscan.php