Monitoring

Monitor your database servers in real-time with live sessions, performance metrics, lock tracking, and replication status - all from within VS Code.

Monitoring gives you real-time visibility into your database servers directly within VS Code. Track active sessions, performance metrics, locks, and replication status without leaving your editor.

Supported Databases

Monitoring is available for databases that expose server-level statistics. The categories available depend on the database:

DatabaseSessionsPerformanceLocksReplication
PostgreSQLYesYesYesYes
MySQL / MariaDBYesYesYesYes
SQL ServerYesYesYesAlwaysOn only
OracleYesYesYesData Guard only
DB2YesYesYes-
SnowflakeYesYes--
MongoDBYesYesYesReplica sets only

Embedded databases (SQLite, DuckDB, PGLite) do not have a server process and are not supported.

Opening the Monitor

  • From the tree - Expand a connection, click the Monitoring node, and select a category.
  • Right-click a connection - Select Server Monitor from the context menu.
  • Command Palette - Run DBCode: Server Monitor and pick a connection.

If a monitoring panel is already open for a connection, it will be focused rather than opening a duplicate.

Sessions

The Sessions tab shows all active connections to the server. Each row includes the user, client, current query, session state, and duration. The columns shown depend on the database - for example, PostgreSQL shows wait events and application name, while MySQL shows the command type and thread state.

Duration values are color-coded: queries running longer than 1 minute are highlighted in yellow, and those over 5 minutes in red.

Actions

Right-click a session row for available actions:

  • Cancel Query - Stops the running query but keeps the session connected. Available on PostgreSQL, MySQL, Oracle, and Snowflake.
  • Kill Session - Terminates the connection entirely. Available on all databases that support monitoring.

Both actions require confirmation. The context menu only shows actions the connected database supports.

Performance

The Performance tab shows server metrics as cards with sparkline charts. Each card displays the current value, a progress bar when a maximum is known, and a trend line that accumulates while the panel is open.

Common metrics include:

  • Connections - Current connection count against the server maximum
  • Cache Hit Ratio - How effectively the database is using its buffer cache
  • Throughput - Transactions, queries, or operations per second
  • Database Size - Total storage used by the database or server

Some databases expose additional metrics such as CPU utilization, memory usage, network throughput, deadlock counts, slow query counts, and temp disk usage. The exact set of metrics depends on what the database server provides - DBCode surfaces everything available without requiring configuration.

Sparkline history is kept in memory while the panel is open. Closing the panel resets it.

Locks

The Locks tab shows current database locks, helping you identify blocking situations. Key information includes the lock type, mode, whether the lock has been granted, and which session is the blocker. Not available for Snowflake.

Replication

The Replication tab shows the state of database replication when configured. The information varies by database:

  • PostgreSQL - Streaming replication lag (write, flush, replay), LSN positions, subscriber state
  • MySQL / MariaDB - IO/SQL thread status, seconds behind source, relay log position
  • SQL Server - AlwaysOn availability group replica states and synchronization health
  • Oracle - Data Guard transport and apply lag
  • MongoDB - Replica set member states, health, and optime

This tab only appears for databases where replication monitoring is supported. It shows empty if replication is not configured on the server.

View Modes

Toggle between two layouts using the buttons in the header:

  • Tabbed - One category at a time with a tab bar (default)
  • All Sections - All categories stacked vertically. Grid sections can be resized by dragging.

Your preference is saved automatically.

Refresh

Data refreshes automatically on a configurable interval (5s, 10s, 30s, or 60s). Use the pause button to freeze the display while examining data, or click refresh for an immediate update.

All categories are polled on every tick regardless of which tab is visible, so sparklines accumulate continuously and tab switching is instant.

View SQL

Click View SQL to open the underlying query in a new editor tab connected to the same database. You can modify and run the query directly - useful for building custom monitoring queries.

Availability

Monitoring is available with a Pro or Team subscription. Core users can try the feature up to 3 times.