Skip to content

feat: query activity drawer - #612

Draft
emrberk wants to merge 4 commits into
mainfrom
feat/query-activity-drawer
Draft

emrberk wants to merge 4 commits into
mainfrom
feat/query-activity-drawer

Conversation

@emrberk

@emrberk emrberk commented Sep 16, 2026

Copy link
Copy Markdown
Member

Query Activity drawer

A new Query Activity button in the right sidebar, directly below Table Details, opens a drawer that lists the queries currently running on the server. It is built on the server's query_activity() function, which now reports live memory usage per query.

What the drawer shows

Header. The title carries a badge with the number of running queries.

Summary tiles.

  • Running queries: how many queries the server is executing right now.
  • Memory in use: the total native memory currently held by those queries. Background work such as WAL apply and view refresh reports no memory and is not counted.

Search. The search box filters the list as you type. It matches the query text, the query id, and the username, case-insensitively. Pressing Escape clears the box. Pressing Escape on an empty box closes the drawer.

Sort. A dropdown offers eight orders: Duration, Memory used, Start time, and Query ID, each ascending or descending. The default is Duration descending, so the longest running query is on top. Queries with no memory data always sort last under Memory used.

Auto refresh. The refresh toggle polls the server once a second while it is on. Turning it off freezes the list. The choice is remembered across sessions. Toggling it either way fetches a fresh list immediately.

What a query row shows

  • State: an hourglass for Running, a cross for Cancelled, a check for Finished.
  • Memory: the memory the query holds right now. When the query has a memory limit it reads used / limit. Background work shows N/A.
  • Duration: how long the query has been running, updated every second. Hover it to see the exact start time with a copy button.
  • Query text: the SQL, formatted for reading. Very long statements show their first and last lines with the middle elided. Hover the block for Open in editor, which opens the full formatted query in a new tab, and Copy, which copies the full formatted query.
  • Footer: the user who ran the query, the worker pool and worker id, a WAL tag when the statement is being applied by the WAL job, the query id, and the Cancel button.

Cancelling a query

Cancel asks for confirmation, then sends a cancel request to the server. The row switches to Cancelled and stays until the server drops the query, which happens at the query's next safe point. Cancel is not offered for WAL rows, because the server refuses to cancel them, nor for rows that are already cancelled or finished. On Enterprise, cancelling another user's query requires the SQL ENGINE ADMIN permission; the server's error is shown as a notification.

Memory warnings

Only memory produces a warning or error tone, and only for queries that run under a memory limit. The tone reflects how much of that limit the query holds. Queries without a limit, and background work that reports no memory, are never coloured. Duration never colours a row, since what counts as long depends on the workload.

Memory used Tone Hover text on the state icon
under 50% of the limit none
50% to 80% warning More than 50% of the available memory used
80% and above error More than 80% of the available memory used

Cancelled queries are never graded.

How a query disappears

The server only lists queries while they run. It does not report an outcome. When a poll no longer returns a query, the row switches to Finished with the hover text "The query left the registry. It finished, failed, or timed out." The row stays for five seconds, then fades out.

While your mouse is over the row, or keyboard focus is inside it, the row stays as long as you like. When you leave it, a fresh five seconds starts. A cancelled query that leaves the server lingers the same way but keeps its Cancelled state.

Other things to know

  • On Enterprise, users without SQL ENGINE ADMIN see only their own queries. Administrators see everything.
  • The drawer's own listing query is hidden from the list.
  • Query ids are assigned by the server and start again from zero after a restart.
  • If the server cannot be reached, the drawer shows an error. If it stops responding while the drawer is open, the last successful list stays visible with a banner until polling recovers.
  • The list is virtualised and stays smooth with thousands of running queries.
  • CPU time and disk I/O per query are not shown because the server does not expose them yet. The drawer is designed so they can be added as further columns.
  • Finished queries are not kept beyond the grace period. Query history is a separate feature.

Changes outside the drawer

Read-only SQL blocks elsewhere in the console, in the AI chat, the table details DDL, and the shared link confirmation, now render as static highlighted text instead of an embedded editor. They look the same, load faster, and their text can be selected with the mouse. Their copy button now appears on hover, like the open-in-editor action already did.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown

Web Console deploy preview

Preview Commit Logs
https://pr-612--web-console.netlify.app 404cb5d build log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant