Sql Server : Connections / Sessions

HKN MZ
4 min readMay 2, 2024

In SQL Server, connections and sessions are fundamental concepts that play a crucial role in how clients interact with the database server. Let’s break down each concept:

Connections:

  • A connection represents the communication pathway between a client application and the SQL Server instance.
  • When a client application connects to SQL Server, it establishes a connection through a network protocol (such as TCP/IP, named pipes, or shared memory).
  • Connections are managed by the SQL Server Database Engine and are typically created and destroyed as needed by client applications.
  • Each connection has its own set of resources and settings, including authentication credentials, session settings, and access permissions.
  • Connections consume server resources such as memory and CPU, so it’s essential to manage them efficiently to avoid resource contention and performance degradation.

Sessions:

  • A client application establishes a connection to SQL Server, it initiates a session to execute queries and perform database operations.
  • Sessions maintain state information about the client’s interaction with the server, including transactional state, temporary objects, and session-specific settings.
  • Each connection may have one or more associated sessions, depending on factors such as connection pooling and multiple active result sets (MARS).

--

--

HKN MZ

I am writing about Sql Server, Elasticsearch and Python. İ am an Database Administrator on SQL Server and Elasticsearch more than 5+ years.