Help › Watch and manage the server

See what runs on the server

List the sessions on a database server, find the one that runs long or blocks others, and cancel its query or end the session.

Querlyn 0.1.0 is not released yet. This help describes it ahead of release.

Server Activity lists the sessions connected to a database server: who is connected, what each is running, for how long, and who waits for whom. From the list you can stop a query or end a session.

It works on every database except SQLite and DuckDB, which are files and have no sessions to list.

Open Server Activity

Select a connection in the sidebar, or be in one of its tabs, and choose Activity at the top of the sidebar, Query › Server Activity, or Server Activity in the connection's right-click menu.

Each connection has one Activity tab. If the connection is not connected, the tab offers Connect.

Read the list

ColumnShows
IDThe session's number on the server.
User, DatabaseWho is connected, and to which database.
Application, ClientThe program, and the address it connects from.
StateFor example Active, Idle, or Idle in transaction.
DurationHow long the session has been in this state. For a running session, how long its statement has run.
Waiting forWhat the session waits for. A session waiting for a lock names who holds it: "Blocked by 4242".
StatementThe SQL it runs, or ran last.

The list is sorted by Duration, longest first. Click a column's header to sort by it; click again to reverse.

A session that has been running, or sitting idle inside a transaction, for 30 seconds or more is marked at the row's edge and its duration is bold.

Querlyn's own sessions on this connection are named, for example "Querlyn: Query 3" for a query tab, so you can tell them from the application's.

Select a session to see its whole statement and its details under the list.

Filters

ControlWhat it doesAt the start
Hide Idle (Command Palette › Database: Toggle Hide Idle Sessions)Hides sessions that do nothing. Sessions idle inside a transaction stay, because they can block others.On
Hide Background (Command Palette › Database: Toggle Hide Background Sessions)Hides the server's own background processes.On
Hide Querlyn's (Command Palette › Database: Toggle Hide Querlyn's Sessions)Hides Querlyn's own sessions.Off
The filter boxShows sessions that contain every word you type, in any column or the statement. In the list, ⌘ on macOS or Ctrl on Windows and Linux and F goes to it.Empty

Refreshing

The list refreshes every 2 seconds while its tab is in front. The line at the top says when it was last updated.

  • Choose another pace from the interval menu: every 1, 2, 5, 10 or 30 seconds.
  • Pause (Command Palette › Database: Pause Server Activity Refresh) freezes the list so that you can read it; Resume (Command Palette › Database: Resume Server Activity Refresh) goes on.
  • Refresh (⌘R on macOS or Ctrl+R on Windows and Linux) refreshes now.

If a refresh fails, the last good list stays, with "Couldn't refresh" and when Querlyn tries again.

Stop a query or end a session

Select the session, then:

ToDo thisWhat happens
Stop what it is runningCancel Query, or ⌘. on macOS or Ctrl+. on Windows and LinuxThe statement stops. The session stays connected.
End the sessionTerminate Session…, or ⌘⌫ on macOS or Delete on Windows and LinuxThe session is disconnected and its open transaction is rolled back.
Copy its statementCopy, or ⌘C on macOS or Ctrl+C on Windows and Linux
Open its statement in a query tab, not runOpen in New Tab, ↩ on macOS or Enter on Windows and Linux, or a double-click

The same choices are in the session's right-click menu.

Warning: Ending a session disconnects someone's application or tool and rolls back whatever it had not committed. Be sure you have the right session.

When Querlyn asks:

  • Terminate Session… always asks.
  • Cancel Query asks on a Production connection, and on any connection when the session is one of Querlyn's own. The buttons read Cancel Query and Keep Running.

Just before acting, Querlyn checks that the session is still the one you saw. If it ended meanwhile, or moved on to another query, nothing is done and a message says so.

A read-only connection refuses both actions; see Read-only connections.

What you are allowed to see and do

What the list shows depends on your database login. Querlyn says so in a note above the list rather than with an error.

DatabaseWithout extra rightsTo see or act on everything
PostgreSQLOther users' sessions are listed with their statement hidden.pg_read_all_stats to see; pg_signal_backend to cancel and end
MySQL, MariaDBOnly your own sessions.PROCESS to see; CONNECTION_ADMIN (MariaDB: CONNECTION ADMIN) to act
SQL ServerOnly your own sessions.VIEW SERVER STATE to see; ALTER ANY CONNECTION to act
Oracle DatabaseOnly your own session.SELECT_CATALOG_ROLE to see; ALTER SYSTEM to act
Amazon RedshiftOnly your own sessions, unless you are a superuser.SYSLOG ACCESS UNRESTRICTED to see
MongoDBOnly your own operations.The inprog privilege to see; killop to cancel and killAnySession to end others'
CassandraEvery client of the node.Nothing more: clients cannot be acted on

What depends on the database

  • SQL Server cannot stop another session's query without ending the session, so only Terminate Session… is offered.
  • Oracle Database: Cancel Query needs Oracle 18c or later.
  • ClickHouse lists running queries, not sessions. Cancel Query and Terminate Session… both stop the query.
  • Snowflake lists running, queued and blocked queries, and needs a warehouse to do so.
  • BigQuery lists the running jobs of the project in the connection's location (US when none is set). Cancel Query cancels a job. Others' jobs need the right to list all jobs (bigquery.jobs.listAll); without it, the list has your own.
  • MySQL: a cancel can stop a newer statement than the one you saw, if the session started one in that moment.
  • PostgreSQL cuts long statements short, at 1 kB unless the server is set otherwise.
  • CockroachDB lists the sessions of every node. Cancel Query and Terminate Session… use CockroachDB's CANCEL QUERY and CANCEL SESSION. A login sees only its own sessions unless it is an admin or has the VIEWACTIVITY privilege.
  • TiDB lists the sessions of every TiDB server of the cluster.
  • MongoDB lists the operations of the server it is connected to, and idle sessions. Cancel Query stops an operation with killOp; Terminate Session… ends its logical session with killSessions, which also rolls back that session's open transaction.
  • Cassandra (4.0 and later, and ScyllaDB) lists the clients connected to the node the connection talks to: each node keeps its own list. Cassandra does not say what a client is running, and cannot stop another client's query or end its connection, so the list is to look at only.

What Querlyn keeps

Nothing. The statements of other sessions are shown and forgotten; they are not written to the query history or to any log.

While the tab is in front, Querlyn keeps one extra connection to the server for it, and closes it when you leave the tab.

Help for Querlyn 0.1.0. All help topics