Skip to main content
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

SELECT md_current_client_connection_id();
SELECT md_current_client_duckdb_id();

Example usage

To interrupt all server-side connections that are initiated by the current client DuckDB instance, we can use:

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();