---
sidebar_position: 3
title: Identify client connection and DuckDB ID
description: Retrieve connection identifiers and DuckDB instance IDs for debugging and monitoring.
---

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

# Identify client connection and DuckDB ID

`md_current_client_connection_id` and `md_current_client_duckdb_id` are two scalar functions that can be used to identify the current `client_connection_id` and `client_duckdb_id`.

## Syntax

```sql
SELECT md_current_client_connection_id();
SELECT md_current_client_duckdb_id();
```

## Example usage
To [interrupt](documentation/sql-reference/motherduck-sql-reference/connection-management/interrupt-connections.md) all server-side connections that are initiated by the current client DuckDB instance, we can use:

```sql
SELECT md_interrupt_server_connection(client_connection_id)
FROM md_active_server_connections()
WHERE client_duckdb_id = md_current_client_duckdb_id()
  AND client_connection_id != md_current_client_connection_id();
```
