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
- Select the query to analyze from realtime visibility, top SQL, or the query list.
- Enter the SQL detail view (left: SQL body / right: execution stats and metrics).
- Click the Tuning guide icon at the bottom right.
- AI analyzes the query and execution plan and presents results in five areas.
- 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.
| Area | Contents |
|---|---|
| Query and plan summary | Query purpose, execution count, accumulated time, and share of total DB load |
| Execution plan inefficiencies | Automatic detection of full table scans, inefficient condition handling, missing index usage, and more |
| Performance analysis | Performance score plus bottleneck visualization based on CPU, disk, cache, and wait-time usage |
| Main issues and optimization recommendations | Concrete tuning directions such as condition improvement, index additions, and execution plan review |
| Reference | Expected 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.
- Pick the suspect query from realtime visibility or top SQL.
- Enter the SQL detail view.
- Click the Tuning guide icon at the bottom right.
- Check the Execution plan inefficiencies and Recommendations that AI presents.
- 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
| Feature | When |
|---|---|
| AI active stack analysis | Identify bottlenecks in a transaction trace — AI active stack analysis |
| AI thread dump analysis | Interpret 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 analysis | Code-level cause for frontend errors — complements RUM |
| WhaTap AI Chatbot / MCP | Natural-language queries across WhaTap data — MCP integration |
Next steps
- Full DB realtime visibility flow → DB realtime visibility
- Track top-load queries → Database monitoring
- Release regression detection flow → Release verification scenario
- Query DB metrics in natural language → MCP integration