Skip to content

Query Optimizer

The Query Optimizer automatically tracks slow queries and provides AI-powered optimization recommendations. Available on paid plans only.

How it works

The agent automatically collects query performance data from MySQL's performance_schema: - Queries are tracked over a 7-day rolling window - Only queries with avg execution time ≥100ms are captured - Query digests (normalized patterns) are stored, not actual data with values - EXPLAIN plans are collected for analysis - Schema and table information is tracked for context

No manual query input required—optimization happens automatically based on your real workload.

Query tracking tabs

Slow Queries tab

Shows queries exceeding the 100ms threshold, sorted by average execution time.

For each query you'll see: - Query digest - Normalized SQL pattern (click to view full details) - Schema - Database name (filterable) - Tables involved - Which tables are accessed - Avg/Max time - Execution time statistics - Executions - How many times the query ran - Rows examined - Total rows scanned - AI indicator - Lightbulb icon when AI recommendations are available - Bookmark - Pin important queries to the top

Sortable columns: Click headers to sort by time, executions, or rows examined.

Queries Missing Indexes tab

Automatically detects queries that performed full table scans or didn't use optimal indexes.

Shows queries where: - sum_no_index_used > 0 (query didn't use any index) - sum_no_good_index_used > 0 (query used a suboptimal index)

Sorted by impact: (executions without index × avg time) to prioritize high-impact queries.

Query details and optimization

Click any query to open the details modal:

  1. Query text - Full normalized SQL
  2. Performance stats
  3. Execution count
  4. Avg/Max/Total time
  5. Rows examined vs rows sent (scan efficiency)
  6. Index usage statistics

  7. EXPLAIN analysis

  8. JSON execution plan
  9. Table access methods
  10. Index usage per table
  11. Join types and conditions

  12. AI recommendations (click "Get AI Recommendations")

  13. Index suggestions with CREATE INDEX commands
  14. Query rewrite suggestions
  15. Schema design recommendations
  16. Expected performance impact

  17. Actions

  18. Bookmark - Pin this query for quick access
  19. Delete - Remove from tracking (query digest will be re-collected if it runs again)
  20. Copy - Copy query text or recommendations

Bookmarking queries

  • Click the bookmark icon to pin important queries
  • Bookmarked queries appear first in the list (highlighted in yellow)
  • Use this to track queries you're actively optimizing

Schema filtering

Use the schema filter input at the top of the query table to show only queries from specific databases.

Best practices

  • Review the "Missing Indexes" tab first for quick wins
  • Bookmark queries you're actively working on
  • Compare health scores before/after applying indexes
  • Test index changes in staging before production
  • Use the AI recommendations as guidance, not absolute rules
  • Monitor the health chart to see impact of optimizations
  • Check existing indexes before creating duplicates: SHOW INDEX FROM table_name

Applying optimizations

AI recommendations provide exact SQL commands:

CREATE INDEX idx_users_email ON users(email);

To apply: 1. Test in staging or dev environment first 2. Check current indexes to avoid duplicates 3. Run the CREATE INDEX command during low-traffic periods 4. Monitor query performance in the dashboard 5. Verify the index is being used: EXPLAIN SELECT ...

Query tracking limits

Your plan determines how many queries are tracked: - Plans typically allow tracking hundreds of unique query digests - Usage is displayed in the MySQL Optimizer header - When limits are reached, oldest/least-used queries may be pruned