Slow query logs

Updated at:

Slow SQL queries can degrade database stability. When facing high database loads or performance fluctuations, database administrators (DBAs) and developers typically start by checking for slow-running queries. Database Autonomy Service (DAS) collects and analyzes SQL statements that exceed a specified execution time threshold and offers optimization recommendations. This feature helps you quickly identify and resolve performance bottlenecks, improving system stability and reliability.

Background

The database kernel generates slow query logs. The configuration parameters and thresholds vary depending on the database engine. For details, refer to the official documentation for your specific database engine.

Procedure

  1. Log on to the DAS console.

  2. In the navigation pane on the left, click Intelligent O&M Center > Instance Monitoring .

  3. Find the target instance and click the instance ID to open the instance details page.

  4. In the left-side navigation pane, choose Request Analysis > Slow Logs.

  5. Select a time range to view the Slow Log Trend, Event Distribution, Slow Log Statistics, and Slow Log Details.

    • In the Slow Log Trend chart, you can select a point in time to view the Slow Log Statistics and Slow Log Details for that time.

      Note

      If a slow SQL statement is too long to be fully displayed, you can hover the mouse pointer over the statement to view the complete SQL statement in a pop-up box.

    • In the Event Distribution area, you can query for slow log events within a specified time range. Click an event to view its details.

    • On the Slow Query Log Statistics and Slow Query Log Details tabs, you can click image to save the slow query log information to your computer.

    • You can click image to go to the OpenAPI Explorer console. The currently selected and entered parameters are automatically carried over for API debugging.

    • In the Slow Log Statistics section:

      • For a target SQL template, click Details in the Actions column to view the Slow Log Sample for that template.

      • Above the list, select filter criteria to refine the data.