Help home > Server Monitor
Server Monitor
See the sessions connected to the database, the current locks, the SQL that takes the most time, and index fragmentation. You can also cancel stuck SQL and kill sessions.
What you can do
| Task | How to open |
|---|---|
| Open the monitor tab | Right-click a connection name in the tree and choose "Server Monitor (Sessions, Locks, Expensive SQL)", or choose "Tools" → "Server Monitor (Sessions, Locks, Expensive SQL)" from the menu (uses the connection of the current tab) |
| Supported databases | SQL Server (including LocalDB), PostgreSQL, MySQL / MariaDB and Oracle. SQLite and SQL Server Compact are not supported |
Getting started: finding the cause of slowness (3 steps)
Check the locks
In Locks, look for rows whose Status is "WAIT" or "Waiting". "Blocked by" is the session that is making them wait (see Locks).Check the blocking session
In Sessions, check that session's SQL and elapsed time (see Sessions).Fix the heavy SQL
In Expensive Queries, pick a query with a long total time, then right-click and choose "View Estimated Execution Plan" to check whether indexes are used (see Expensive queries).
Sessions
Lists the sessions connected to the database, with running sessions first. The row with ○ in "Self" is this Musubi SQL connection.
| Column | Contents |
|---|---|
| ID | The session number ("SID,SERIAL#" in Oracle). Used to cancel or kill |
| Status, Wait | Whether it is running and what it is waiting for (as reported by the database) |
| Blocked by | The ID of the session this session is waiting for |
| Elapsed ms / Elapsed s | Time since the current SQL started (seconds in MySQL and Oracle) |
| SQL | The running (or most recently run) SQL |
Turn on "Hide idle sessions" to hide sessions that aren't doing anything.
Locks
Lists the locks held by sessions and the sessions waiting for locks, with waiting rows first. While the session shown in "Blocked by" keeps holding its lock, other sessions can't proceed.
Expensive queries
Shows the top 100 queries by total execution time, from the execution statistics the server records. Executions, average time and average reads tell you which SQL is worth fixing first.
| Database | Source |
|---|---|
| SQL Server | sys.dm_exec_query_stats (statistics since the server last restarted) |
| PostgreSQL | The pg_stat_statements extension |
| MySQL | performance_schema.events_statements_summary_by_digest (literal values are normalized to ?) |
| Oracle | V$SQLAREA (excluding SYS and SYSTEM) |
Right-click a row for "Open SQL in SQL Tab", "View Estimated Execution Plan" and "Copy SQL". In PostgreSQL and MySQL, values appear as $1 or ?, so replace them with real values before viewing the execution plan.
Index fragmentation
Checks how fragmented the indexes in the current database are and lists the ones that likely need a rebuild first. Because this can take a while on a large database, switching to this view does not run it. Click ▶ Inspect (auto refresh does not apply).
| Database | How it is measured | "Recommendation" guideline |
|---|---|---|
| SQL Server | Fragmentation and page count from sys.dm_db_index_physical_stats (LIMITED) | Indexes under 1,000 pages are ignored. Reorganize at 5–30%, rebuild at 30% or more |
| PostgreSQL | Leaf density and fragmentation from pgstatindex in the pgstattuple extension (B-tree only). It reads every index, which adds load | Rebuild when leaf density is below 70% or fragmentation is 30% or more |
| MySQL | Per-index values are not available, so this shows the share of free space (DATA_FREE) per table from information_schema.TABLES. The values are cached statistics; run ANALYZE TABLE first for fresh values | OPTIMIZE TABLE at 20% or more |
| Oracle | Fragmentation cannot be measured without locking the table, so this estimates it from the statistics in ALL_INDEXES (height/BLEVEL and leaf blocks, current schema) | A height of 4 or more is a rebuild candidate. Gather statistics first when they are missing or stale |
Select rows and right-click to open the rebuild, reorganize, or statistics SQL in a SQL tab (nothing is run immediately). With several rows selected, all statements go into one SQL tab. Review them before running.
REBUILD, PostgreSQL REINDEX (without CONCURRENTLY), and MySQL OPTIMIZE TABLE can block updates to the table while they run. On production systems, run them during quiet hours.Canceling SQL and killing sessions
Right-click a row in Sessions or Locks. Both actions ask for confirmation first. They aren't available for your own connection or on read-only connections.
| Menu | SQL that runs |
|---|---|
| Cancel Running SQL | PostgreSQL pg_cancel_backend, MySQL KILL QUERY, Oracle ALTER SYSTEM CANCEL SQL (not available in SQL Server) |
| Kill Session | SQL Server KILL, PostgreSQL pg_terminate_backend, MySQL KILL, Oracle ALTER SYSTEM KILL SESSION |
Required permissions and settings
| Database | Requirements |
|---|---|
| SQL Server | The VIEW SERVER STATE permission. Killing sessions requires ALTER ANY CONNECTION. Index fragmentation requires VIEW DATABASE STATE |
| PostgreSQL | The pg_read_all_stats role to see other users' SQL. Expensive queries require the pg_stat_statements extension (add it to shared_preload_libraries, restart, then run CREATE EXTENSION pg_stat_statements). Index fragmentation requires the pgstattuple extension (CREATE EXTENSION pgstattuple) and, for non-superusers, the pg_stat_scan_tables role |
| MySQL | The PROCESS privilege to see other users' sessions. Locks and expensive queries require read access to performance_schema (locks show more detail on 8.0 and later) |
| Oracle | Read access to V$SESSION, V$LOCKED_OBJECT and V$SQLAREA (for example, SELECT_CATALOG_ROLE). Killing sessions requires the ALTER SYSTEM privilege |
FAQ
An error appears and the list is empty
A permission or a required setting is missing. What you need is shown below the error (see Required permissions and settings).
I only see my own session
You don't have permission to see other users' sessions. Ask your database administrator to grant it.
The list doesn't change
The lists are reloaded when you open the tab and when you click ⟳ Refresh. Choose an "Auto refresh" interval to reload periodically while the tab is visible.
▲ Back to top