Documentation

SQL Profiling

SQL Profiling

The SQL Query Profiling activity is a feed of the queries the server itself has captured — normalized by shape and aggregated by execution count and time. It's where you go when you want to know which queries are slow on a given connection, so you can then open them in the SQL Editor and EXPLAIN them yourself.

Quick Start

  1. Open the Query Profiling activity from a SQL connection's action bar.
  2. If profiling is disabled on the server, an amber banner appears with an Enable button — clicking it turns on the server-side capture (where the driver allows it).
  3. Pick which database(s) to include using the database multi-select, or leave "All databases" selected.
  4. Type in the filter box to narrow the list by substring on the query text or database name.
  5. Sort by Total (ms) or Avg (ms) to find your worst offenders; hover a row and click the arrow icon to open the query in a new SQL Editor tab.

Beta

SQL support is in active development. Server-side profiling capture varies by dialect — the activity surfaces whatever the driver returns from the equivalent of MySQL's performance schema. Where the driver can't enable capture, the banner explains why and the Enable button is hidden.

Opening It

Query Profiling is scoped to a single SQL connection — open it from the connection's action bar. If the connection is not currently connected, the panel shows a "Connect now" link that establishes the connection and immediately loads.

Enable / Disable Profiling

Some servers ship with profiling capture switched off. In that case, the top of the activity shows a Profiling Disabled banner:

  • Amber banner + Enable button — the driver reports profiling can be turned on. Click Enable to switch it on for this connection; the button briefly shows "Enabling..." then the feed populates as soon as new queries run and refresh is hit.
  • Red banner, no button — the driver can't enable capture from here (missing privilege, configuration must be set at the server level, or the dialect doesn't expose an equivalent). The message explains what's needed.

Filters & Sort

  • Database multi-select — top-left dropdown with per-database checkboxes plus All / None shortcuts. When only one database is selected, the Database column collapses to save horizontal space.
  • Query filter — free-text search across the query body and the database name. Clears with the little × on the right.
  • Sortable columns — Database, Executions, Total (ms), Avg (ms), Max (ms). Click a header to sort; click again to reverse.
  • Refresh — top-right button; polling isn't automatic, so refresh after a burst of activity to see new aggregates.

The Query Row

Each row shows a captured, normalized query with these fields:

Field What it shows
DatabaseWhich database the query ran against (hidden when a single DB is selected).
QueryThe captured statement, truncated at 300 characters with an ellipsis if longer.
ExecutionsHow many times the server has seen this query since capture started.
Total (ms)Sum of execution time across all runs — highlighted when it crosses a warning threshold.
Avg (ms)Mean per-execution time.
Max (ms)Slowest single execution.
Open in SQL EditorHover-only arrow icon at the end of the row; opens the full query in a new SQL Editor tab so you can EXPLAIN it or edit and re-run.

Pro Tips

  1. Sort by Total (ms), not Max. A query that averages 5ms but runs 100,000 times will hurt more than a one-off 5-second report. Total is the honest cost.
  2. Filter by SELECT or by table name when the feed is noisy — the substring filter matches both the query body and the database column.
  3. Enable, wait, refresh. Right after enabling profiling the feed is empty — capture only sees new queries. Run a bit of load, then refresh.
  4. Send hot rows straight to the SQL Editor for EXPLAIN. Query Profiling tells you what to look at; the editor is where you actually diagnose it.
  • SQL Editor - Where the "Open in SQL Editor" action lands. Run EXPLAIN and try alternative rewrites.
  • SQL System Monitor - Live view of what's running right now, complementing this historical feed.
  • Tables Info - Confirm size and shape of the tables involved before proposing an index.

Ready to try VisuaLeaf?

Download and start managing your MongoDB databases with ease.

Download Free Trial