---
sidebar_position: 1
title: Monitoring active server connections
description: View active connections and running queries in MotherDuck using md_active_connections.
---

:::info
This is a preview feature. Preview features may be operationally incomplete and may offer limited backward compatibility.
:::

# Monitoring active server connections

:::tip
You can also monitor running queries in the MotherDuck UI under **Settings** → **Running Queries**. See [Running Queries](/getting-started/interfaces/motherduck-quick-tour/#running-queries) for details.

For an org-wide view of running and recently completed queries, see the [`RECENT_QUERIES`](/sql-reference/motherduck-sql-reference/md_information_schema/recent_queries/) view (for admins on the Business plan).
:::

The `md_active_server_connections` table function can be used to list all server-side connections that have active transactions.

## Syntax

```sql
FROM md_active_server_connections();
```

This returns a list of active server connections, with the following information:

| **column_name**                     | **column_type** | **description**                                                                  |
|-------------------------------------|-----------------|----------------------------------------------------------------------------------|
| client_duckdb_id                    | UUID            | Unique identifier for the client DuckDB instance that initiated the connection   |
| client_user_agent                   | VARCHAR         | User agent for the client                                                        |
| client_duckdb_version               | USMALLINT[3]    | DuckDB version from the client                                                   |
| client_connection_id                | UUID            | Unique identifier for the client DuckDB connection that initiated the connection |
| client_transaction_id               | UBIGINT         | Identifier for the transaction within the current connection                     |
| server_transaction_stage            | VARCHAR         | Stage the server-side transaction is in                                          |
| server_transaction_elapsed_time     | INTERVAL        | How long the server-side transaction has been in the current stage               |
| client_query_id                     | UBIGINT         | Identifier for the query within the current transaction                          |
| client_query                        | VARCHAR         | Query string (possibly truncated)                                                |
| server_query_elapsed_time           | INTERVAL        | How long the query has been running on the server-side                           |
| server_query_execution_elapsed_time | INTERVAL        | How long the connection has been interrupted                                     |
| server_query_progress               | DOUBLE          | Progress information (value between 0.0 and 1.0)                                 |
| server_interrupt_elapsed_time       | INTERVAL        | How long the connection has been interrupted                                     |
| server_interrupt_reason             | VARCHAR         | Why the connection was interrupted                                               |
| query_total_upload_size             | UBIGINT         | Data uploaded in Bytes                                                           |
| query_total_download_size           | UBIGINT         | Data downloaded in Bytes                                                         |
