Skip to main content

Using the AI SQL tuning guide

The SQL detail view already shows execution statistics and plans, but for users new to the screen or not DBAs, judging "where the problem is" is hard. WhaTap's AI SQL tuning guide automatically analyzes the current query state and suggests concrete performance improvement directions. Non-DBAs can quickly get to the cause of inefficient queries and see what to do next.

Prerequisites

  • Project member or higher permission
  • The query to analyze has been collected (visible in realtime visibility, top SQL, or the query list)

How to use it

Path: SQL detail view > Tuning guide icon at the bottom right

  1. Select the query to analyze from realtime visibility, top SQL, or the query list.
  2. Enter the SQL detail view (left: SQL body / right: execution stats and metrics).
  3. Click the Tuning guide icon at the bottom right.
  4. AI analyzes the query and execution plan and presents results in five areas.
  5. Start from the Main issues and optimization recommendations section, then prioritize using the expected reduction ratio.

Analysis result structure

AI analyzes the query and execution plan and presents results in five areas.

Table | AI analysis result structure
AreaContents
Query and plan summaryQuery purpose, execution count, accumulated time, and share of total DB load
Execution plan inefficienciesAutomatic detection of full table scans, inefficient condition handling, missing index usage, and more
Performance analysisPerformance score plus bottleneck visualization based on CPU, disk, cache, and wait-time usage
Main issues and optimization recommendationsConcrete tuning directions such as condition improvement, index additions, and execution plan review
ReferenceExpected execution time and reduction ratio if the improvements are applied

The expected execution time and reduction ratio let you estimate the tuning effect before applying it.

When to use it

Identifying DB bottleneck causes (most useful)

You can directly analyze the top-load queries identified in the DB realtime visibility scenario.

  1. Pick the suspect query from realtime visibility or top SQL.
  2. Enter the SQL detail view.
  3. Click the Tuning guide icon at the bottom right.
  4. Check the Execution plan inefficiencies and Recommendations that AI presents.
  5. Use the expected reduction ratio to prioritize tuning.

Release verification

When DB load spikes after a deploy, running AI analysis on the responsible query lets you quickly tell whether the regression is a newly added query or a plan change. Apply this in step ② Acute regression detection of the Release verification scenario.

Periodic DB performance review

Run the AI tuning guide on the top N queries every quarter to build a backlog of Medium/Low improvement opportunities. Fold the results into the retrospective of the Performance reporting scenario.

Understand the limits of AI analysis

AI output is a first hypothesis, not the final conclusion. Use it this way:

  • AI-suggested index or condition changes should be validated in staging before applying to production.
  • Expected execution time and reduction ratio are statistics-based estimates — actual results may differ.
  • Business context (data distribution changes, traffic events) is not visible to AI — cross-check with a DBA.
  • Repeated analysis may not be fully consistent (LLM nature) — validate with actual execution time and load metrics.

Adjacent AI analysis features

Table | Adjacent AI analysis features
FeatureWhen
AI active stack analysisIdentify bottlenecks in a transaction trace — AI active stack analysis
AI thread dump analysisInterpret thread blocking and lock contention in an instance — AI thread dump analysis
AI SQL tuning guide (this guide)Identify inefficient queries and get execution-plan based improvements
AI browser error stack analysisCode-level cause for frontend errors — complements RUM
WhaTap AI Chatbot / MCPNatural-language queries across WhaTap data — MCP integration

Next steps