Path

Match what you recorded to one of five fixes and apply it on your database. The path does not run SQL.

Estimated time: 2 min

Apply a fix

To apply the fix that follows the diagnosis, match what you recorded to one of the fixes below.

  1. Based on your diagnosis, use the following table to identify the appropriate fix. Each fix is described on Improve slow queries.

    What you recordedFix
    The filtered, joined, or sorted column has no Indexed badge, or the index column order doesn’t matchAdd or modify an index that matches your filters, joins, and sort order
    The plan shows a table scan although an index exists, or the query wraps a column in a function such as YEAR(created_at)Rewrite the query so the database can use the index, for example as a date range
    Calls is high and the samples show many short, near-identical executionsBatch the N+1 pattern into one query with IN or a join
    The wait events breakdown is dominated by lock waitsReduce lock time: shorter transactions, consistent lock order, appropriate isolation level
    The wait events breakdown is dominated by I/O waitsReduce data scanned: add indexes, increase cache memory, review storage throughput

    Select an AI assistant button (for example, Explain this query) on any Query details tab for a suggestion, and validate it against your explain plan and query samples before applying it.

    Apply the fix on your database, then continue to compare the result.

You chose the fix that matches your diagnosis and applied it on your database.