Slow Query Monitoring is designed to help you detect and analyze SQL queries that take a long time to execute. By identifying these slow queries, you can take steps to optimize them, improving the overall performance of your database and web applications.

This guide provides detailed instructions on how to enable, configure, and use the Slow Query Monitoring feature to identify and optimize slow SQL queries that could be impacting your database and web application performance.

Enabling Slow Query Monitoring

To enable Slow Query Monitoring, follow these steps:

#1 – Navigate to the RunCloud Monitoring Tab: First, log in to your RunCloud dashboard and click on a server that you want to monitor. Next, go to the RunCloud Monitoring section in the left menu and switch to the Slow Query tab.

    #2 – Enable Slow Query Monitoring: On this page, click the “Enable Slow Query” switch to turn on Slow Query Monitoring – this will open up a modal.

      Configure Slow Monitoring

      In the pop-up modal, you can configure the following settings to customize the logging process:

      #1 – Set Monitoring Duration

        Click on the Enable Slow Query For dropdown to specify the duration for which you want to monitor slow queries. For example, you can set the monitoring to run for 3 minutes and turn off automatically afterwards.

        Note: The monitoring process consumes server resources, so it is recommended that you only enable it for debugging purposes.

        #2 – Define Slow Query Threshold

            If you want to monitor slow queries, you need to set a Slow Query Threshold, i.e., the threshold for what constitutes a “slow” query. This is the time (in seconds) that a query must exceed to be logged as slow.

            For example, setting the threshold to 1 second means that any query taking longer than 1 second to execute will be captured and logged for review.

            Viewing Captured Slow Queries

            Once Slow Query Monitoring is enabled, and the specified duration has passed, the captured slow queries will be available for review in the Slow Query tab.

            The query panel will show details of each captured slow query, including the execution time, query text, affected rows, and other relevant metrics.

            By analyzing this log, you can detect queries that negatively impact your database and application performance, allowing you to take corrective actions and enhance overall efficiency.