Active sessions
Right-click a connected PostgreSQL, MySQL or SQL Server connection in the navigator and choose Active sessions. The tab lists the sessions on the server, the active ones first.
| Column | What it shows |
|---|---|
| ID | The server's session id: the PostgreSQL pid, the MySQL connection id, the SQL Server session id |
| User, Database | Who is connected, and to which database |
| Client | The client's address and application name, for example 10.0.4.17 · airflow |
| State | active, idle, idle in transaction (PostgreSQL), Query, Sleep (MySQL), running, sleeping (SQL Server) |
| Time | How long the session has been in that state; for a running statement, how long it has run |
| Wait | What it is waiting for, such as a lock or a disk read, when the server reports it |
| Query | The statement it runs, or ran last. Hover to read it whole |
The session marked Selekta is the one this list was read through. The list refreshes every 5 seconds while the tab is open; change that with Refresh (2 s to 30 s, or Off). Hide idle leaves out sessions that are doing nothing, and the filter box searches every column.
Cancel a query or end a session
Each row has two buttons:
- Cancel query (square icon) stops the statement the session is running. The session stays connected; its client gets an error (in Selekta the result says the server stopped the statement). PostgreSQL and MySQL only.
- Terminate (unplug icon) ends the session. An open transaction in it is rolled back. On SQL Server this is the only option.
Both ask first. On a Production connection, ending a session asks you to type its id. Read-only connections list sessions but do not cancel or end them, and the session Selekta reads the list through has no buttons.
Permissions
The server decides what you see and what you may end:
| Database | To see every session | To cancel or end other users' sessions |
|---|---|---|
| PostgreSQL | pg_read_all_stats (others' query text) |
Superuser or pg_signal_backend; your own role's sessions always |
| MySQL | PROCESS |
CONNECTION_ADMIN (or SUPER); your own sessions always |
| SQL Server | VIEW SERVER STATE |
ALTER ANY CONNECTION |
Without these, the list shows your own sessions. On SQL Server without VIEW SERVER STATE it shows your sessions without their statements.