On this page

Live connections

See every session connected to your database, find long-running queries, idle transactions and blocked sessions, and cancel or close your own.

Database › Connections in Studio lists every session that holds a connection to your project's database: your app, the pooler, the REST API, Auth, Storage, Realtime, agent keys and your own database roles. Use it when the database feels slow, when you run out of connections, or when a migration waits on a lock.

#What you see

ColumnMeaning
RoleWho is connected: your database role, an agent key role, one of your own roles, or a platform service (REST API, Auth, Storage, Realtime, Connection pooler)
Application and clientThe application_name the client sent, and its IP address
StateActive, Idle, Idle in transaction, Idle in failed transaction or Function call
QueryThe statement running now or last run, with secrets removed. The SQL of platform services is hidden; that of the REST API is shown
Running forHow long the query, the transaction and the state have lasted
Wait eventWhat the session waits on, for example a lock

The summary at the top counts all, active, idle and idle-in-transaction sessions, long-running and blocked ones, and your database role's connections against its limit.

#Find problems

  • Long-running: an active query that has run longer than the time you pick under Long-running after (10 s, 30 s, 1 min or 5 min; default 1 min).
  • Idle in transaction: a session that opened a transaction and stopped sending statements for 30 seconds or more. It holds its locks and a connection until it ends.
  • Blocked: a session waiting for a lock. The session that holds the lock is marked too, with the number of sessions it blocks.

Use Show to list all sessions, only your roles, only those that need attention, or only active ones. The list refreshes every 5 seconds; choose 2, 10 or 30 seconds, or Pause it.

#Cancel or close a session

  • Cancel query stops the running statement. The connection stays open; the client gets a canceling statement due to user request error and its transaction is rolled back.
  • Terminate connection closes the connection. Its open transaction is rolled back and the client has to reconnect.

Both work only on sessions of your project's database role and your agent key roles, never on platform services. Read-only members can look but not act. Every cancel and terminate is written to the audit log.

#From AI tools

AI tools connected over MCP read the same list with list_connections (optional long_query_s and idle_s, 1 to 3,600 seconds). It is read-only: cancelling and closing are done in Studio.

For the statements that cost the most time over days, see Query performance. For alerts when connections run short, turn on health alerts.