Active Queries
View currently running PostgreSQL queries in tpaw — see query text, duration, state, and client info.
Active Queries shows every query currently executing or waiting on your PostgreSQL server, sourced from pg_stat_activity. Each entry shows the PID, application name, database, state, duration, and the full SQL text.
What the panel shows
Each row in the Active Queries table represents one backend connection:
| Column | Description |
|---|---|
| PID | PostgreSQL backend process ID |
| State | active, idle, idle in transaction, idle in transaction (aborted) |
| Duration | Time since the current query started (or last state change) |
| Database | Database name the connection is using |
| Application | application_name set by the client |
| SQL | The query text (truncated with expand option) |
Query state colors
- Active (green) — query is currently executing
- Idle in transaction (yellow) — session has an open transaction but is idle — often indicates a stuck or forgotten transaction
- Idle (muted) — connection is waiting for the next command
Expanding query text
Long SQL statements are truncated in the table. Click the expand icon or the row to view the full SQL with syntax highlighting and newline formatting.
Copying query text
Click the copy icon on any query row to copy the full SQL to the clipboard.
Inspecting a query
Click any row to open a detail drawer showing the full query text, duration, and client info.
Auto-refresh
The Active Queries panel refreshes automatically every few seconds. The "Updated X ago" indicator in the toolbar shows when the data was last fetched.
Slow query detection
tpaw highlights queries that have been running for an unusually long time. The duration badge uses color coding:
- Green — under 1 second
- Yellow — 1–10 seconds
- Red — over 10 seconds