Skip to content

SQL Monitor

Available in v2.1.0+. SQL Monitor is part of the server’s SQL Editor web UI, available in a browser with --web-ui and in the desktop SQL workspace.

Start the server with --enable-instrumentation, open /ui/, and sign in as an unrestricted administrator. SQL Monitor refreshes every two seconds. Without instrumentation its navigation item is disabled; /ui/monitor explains how to enable it. Server Configuration is available even when instrumentation is disabled.

The server enforces both pages’ permissions. A regular user, tenant administrator, or administrator token limited by catalog_access cannot call the underlying administrative functions. HARDCHARGER_IS_FULL_ADMIN() reports the caller’s capability; UI navigation uses it too. Each page has its own observer session with queue bypass explicitly enabled, so it stays usable when all normal statement slots are occupied and never enters an editor’s transaction. That session closes when the page is left.

SQL Monitor sorted by longest elapsed time, with Reset sorting, queue status and filters

  • Queued: waiting for a concurrency slot. Executing: admitted, before its first result batch. Fetching: the server has fetched a batch and still holds the result. All three remain visible regardless of the selected time window.
  • Succeeded, Failed, Cancelled, Execution timed out, and Queue timed out describe completed attempts. The time window applies to completion time, so a query that started hours ago and just finished still appears in the default ten-minute window.
  • The queue cards show whether queueing is enabled, enforced slots in use and available, queued statements, and capacity. Zero concurrency limit means unlimited concurrency; zero queue capacity means an unbounded queue. Administrators may bypass slots; those statements are visible but do not consume the enforced slot count. Lowering a live limit can leave more slots in use than the new limit until existing work finishes.
  • Choose 1 minute through 24 hours, filter by status or SQL/user/execution ID, pause automatic refresh, or click SQL for its full redacted text, identifiers, row count, timeline, cancellation reason, and error. Time filters always retain active work; explicit status and text filters still apply. Monitor queries are hidden by default.
  • History starts with the most recent 1,000 recorded completions (plus a lookahead row and recent live completions); Load 1,000 more completions expands it. Active work is never subject to that cap. This page monitors this server instance, including with a shared PostgreSQL instrumentation catalog.

hardcharger_live_queries() is a synchronous snapshot independent of the asynchronous history writer. It retains every active execution and the most recent 2,048 completions (up to 16 MiB, excluding query profiles) to bridge write latency. The page merges it with the instrumentation execution_details view by execution ID, preferring live state. hardcharger_monitor_info() provides a consistent snapshot of queue counts plus instrumentation backlog, dropped and failed event counters. Loss counters mean persisted history may be incomplete; the live snapshot still shows active statements. State and queue counts are separate samples, so a statement may finish between them.

The existing instrumentation timeline measures server processing, not proof of client delivery. A result handle can be produced before its rows are evaluated. Fetch start is the first batch fetched by the server, fetch end its final batch, and cursor close the result’s release. Streaming network delivery may continue after the server has fetched the rows. The monitor cannot measure how long a client spends using downloaded data. SQL text uses the same redaction and abbreviation rules as the query log.

Click a column header to sort by status, user, SQL, start time, queue wait, elapsed time or rows fetched. Click it again to reverse the direction. Elapsed starts with the longest queries first; Queue wait and Rows fetched also start with the largest values. The arrow in the header shows the current direction.

The default is Started / Queued, newest first: execution start time when available, or queue time while the statement is waiting. Reset sorting restores that order without changing the filters. Your chosen order stays in effect across the two-second refreshes. Active statements participate in that order rather than staying above completed statements. Sorting covers the rows already loaded; use Load 1,000 more completions to include more history. Missing values sort last.

Click SQL to open a separate Query details window by default. Each window follows that execution and refreshes every two seconds, independently of the monitor’s filters, recent-history cutoff, and original workspace. Its captured profile and JSON download remain available after reloading the window. Choose Query details → Below monitor for the inline layout; its Pop out button moves the current inspection to a window. The layout preference is remembered. Browsers that block the pop-up show a notice and fall back to inline details. The desktop app opens native inspector windows; stopping or restarting its server closes the workspace and all inspectors. Closing a desktop workspace also closes its inspectors and ends their observer sessions; cancelling the transaction-close confirmation keeps all of those windows open. Browser pop-outs can remain open independently of their original browser tab.

SQL text has a bordered, keyboard-focusable scroll area. Long lines wrap, and the execution metadata stays outside that area. Copy SQL copies the complete captured text, including content outside the visible scroll area.

The timing table separates queue wait, initial execution until the result cursor is ready, fetch setup through the first batch, remaining result fetching, cursor release and total elapsed time. Active steps show elapsed time so far at the latest refresh; completed steps stay fixed. A statement stopped in the queue shows execution as Not started. Missing timestamps stay unknown rather than becoming zero durations. Timestamps use your local time; an end date is repeated only when it differs from the start’s calendar date. Hover the end time to see its full date. From v2.11.0, elapsed values use milliseconds with two decimal places and aligned decimal points. Positive durations below 0.01 ms keep the <0.01 ms indicator; so far appears on its own line for a step still in progress.

Each inspector opens its own observer sessions and enforces the same unrestricted administrator permission. It uses the existing short-lived sign-in in session storage; credentials are never put in the detail URL or local storage. Closing the inspector ends its own sessions without touching the monitored query or editor sessions.

Select a statement to retrieve its existing query_profile from instrumentation for that execution ID and this server instance. The UI never reruns the statement or issues an EXPLAIN ANALYZE. With hardcharger.capture_query_profile set to standard or detailed for the original execution, its details show the operator tree, actual/estimated rows, operator times, scan counts, query and CPU times, memory and I/O, and every other captured metric group (optimizer, parser and planning metrics when present). Units come from the server’s duckdb_available_metrics() metadata; missing metrics remain missing, while zero measurements are shown as zero. See DuckDB 2.0 metrics.

Profiles are fetched only for the selected statement, after its result closes and the instrumentation writer records it. A pending profile is retried automatically. Completed executions without a profile are labeled clearly; changing capture settings cannot produce profiles retroactively. The current global capture setting is shown as context, since the execution’s session may have overridden it. Operator times can overlap with parallel work and are not percentages of total elapsed time. All raw JSON can be inspected or downloaded verbatim. Observer sessions disable their own profile capture to avoid profiling the monitor.

A captured execution plan with duration bars, a highlighted hash aggregate, aligned times and formatted row estimates

The Time column draws a gradient bar behind each duration, scaled to the slowest operator in that profile. A half-width bar means half that operator’s time; it does not mean half the query’s elapsed time. Parallel operators can overlap.

Color Time relative to the slowest operator
Red — Long 50% or more
Amber — Medium At least 10%, below 50%
Blue — Short Below 10%

Up to three expensive operators receive a Slow operator label. Choose Operator order → Slowest first to bring them to the top, or Plan order to see the tree. In plan order, the arrow beside an operator collapses or expands its children. Collapse small subtrees hides children of subtrees whose combined operator time is at most 1% of the profile’s summed operator time; Expand all restores them. Automatic collapsing is unavailable when the captured operator list is truncated.

Actual and estimated row counts use thousands separators. Estimates that differ from actual rows by 10× or more are highlighted to help locate planning errors. Operator times use milliseconds with three decimal places and aligned decimal points, making short and long steps easier to compare.

Status display chooses Icons (the default) or Descriptions, remembered in this browser. Every icon has a tooltip and accessible name. Executing statements have a spinning circle in both modes; reduced-motion preferences disable its animation.

Cancel work cancels all queued and in-flight work in the selected statement’s session, including fetching, and keeps the session connected. It uses hardcharger_cancel(session_id); it is deliberately a session-work action, not a promise to cancel only one execution ID. End session uses KILL SESSION to cancel work and disconnect that session (an open transaction is rolled back). Both actions ask for confirmation identifying the user and session. The monitor cannot cancel or end its own observer session, and ended sessions have disabled controls. A statement that finishes before cancellation produces a clear “no active work remained” response. The server enforces its existing session-control permissions.

SQL Monitor hides generated internal queries and monitoring queries by default. Explicit producer tags determine the categories; SQL text is not used to guess whether a query is internal. Rows show Internal and Monitoring badges and expandable query tags. Search matches tag names and values as well as SQL, users and execution IDs.

Include internal queries and Include monitor queries work independently. Either toggle reveals a query tagged as both; clearing both hides both categories. User-authored SQL and its session tags remain visible by default.

Query results and script messages open the exact recorded execution directly. In a detail view, choose Formatted / Original before copying SQL. Profiles and details follow the originating server, including remote editor tabs, without rerunning SQL.