The Slow Query Log. This can often be a good starting place to see which queries are slowest and how often they are slow. Enabling the Slow Query Log for MySQL or MariaDB can be a useful tool to diagnose performance and efficiency issues affecting your server.
Locate the configuration section mysqld. Show activity on this post. The slow query log consists of SQL statements that take more than long_query_time seconds to execute and require at least min_examined_row_limit rows to be examined.
MySQL and MariaDB optionally log slow queries into the Slow Query Log or just Slow Log as friends call it.
This allows you to find inefficient SQL queries that can be optimized to improve database performance. Show activity on this post. After that then do the following commands to create the file with the right ownership and file permissions. The slow query logs will show you a list of queries that have been identified as slow based on the given values in the system variables as mentioned earlier.