← Back to list

Understanding MSSQL Server Architecture: A Deep Dive for DBAs & Developers

If you’ve worked with Microsoft SQL Server (MSSQL) for a while, you’ve probably typed hundreds of SELECT statements without ever wondering…

Arjun M · 2026-07-05 17:36 · 0 claps · 3.0 min read
#ms-sql-server #sql-server #sql #sqlalchemy #sqlite
Open on Medium ↗
Wiki topics: 🏛️ · Architecture

Understanding MSSQL Server Architecture: A Deep Dive for DBAs & Developers

If you’ve worked with Microsoft SQL Server (MSSQL) for a while, you’ve probably typed hundreds of SELECT statements without ever wondering what actually happens between hitting "Execute" and seeing your results. Underneath that simple query interface sits a highly engineered system of components working together — parsing your SQL, optimizing it, fetching data from disk, caching it in memory, and guaranteeing that your transaction survives a server crash.

This post breaks down SQL Server’s architecture layer by layer, so the next time something is slow or a deadlock shows up in your logs, you’ll know exactly where to look.

The entire process begins when a client application sends a query request, which is then processed through three core layers: the Protocol Layer, the Relational Engine, and the Storage Engine, all operating on top of a specialized mini-operating system called the SQLOS.

Client Application │ ▼ Protocol Layer (TDS) │ ▼ Relational Engine (Query Processor) │ ▼ Storage Engine │ ▼ Data Files (.mdf/.ndf) & Log Files (.ldf)

1. The Protocol Layer

The Protocol Layer handles incoming connections and intercepts client requests using the SQL Server Network Interface (SNI). It packages and unpacks data using a Microsoft network protocol known as Tabular Data Stream (TDS).

Connections are accepted via three major protocols:

  • Shared Memory: Used strictly when the client application and SQL Server reside on the same physical machine.
  • TCP/IP: The default standard protocol used for communicating with remote database clients over a network.
  • Named Pipes: Typically reserved for local area networks (LANs) to facilitate inter-process communication.

2. The Relational Engine (Query Processor)

Often referred to as the brain of SQL Server, the Relational Engine figures out exactly what a query needs to achieve and determines the absolute best execution path.

  • Command Parser: Checks the T-SQL query for syntax and semantic errors, translating the code into an internal data structure called a query tree. It also generates a query text hash to check the plan cache to see if a compiled execution plan already exists.
  • Query Optimizer: The core component of the engine. If no cached plan is found, the cost-based optimizer evaluates thousands of combinations of joins, indexes, and execution sequences to choose a “good enough” plan based on CPU and memory costs.
  • Query Executor: Executes the final execution plan generated by the optimizer, making requests to the underlying Storage Engine via OLE DB to retrieve or modify data pages.

3. Storage Engine

The storage engine is responsible for physical data storage, transactional integrity, and I/O coordination.

  • Access Methods: Manages the logical placement of structures like heaps, data rows, clustered indexes, and 8KB pages and extents. It handles the layout of the primary data files (.mdf), secondary data files (.ndf), and log files (.ldf).
  • Buffer Manager: Controls the Buffer Pool (the single largest consumer of memory in SQL Server). It maintains the Data Cache (frequently read pages) and Plan Cache. When data is modified in memory but not yet written to disk, it is called a “dirty page” until a background Checkpoint process writes it to the storage drive.
  • Transaction Manager: Enforces ACID properties. It uses the Lock Manager to prevent overlapping transactions from modifying the same data concurrently, and a Log Manager to write every transaction to the Transaction Log before it touches the physical database (Write-Ahead Logging).

4. SQLOS: The Hidden Operating System

Below all of this sits SQLOS (SQL Server Operating System) — a thin layer that manages scheduling, memory allocation, and I/O completion within SQL Server itself, instead of relying purely on the Windows OS scheduler. It uses a non-preemptive, cooperative scheduling model, letting SQL Server control thread scheduling more precisely than the OS would, which is critical for handling thousands of concurrent queries efficiently.

Putting It All Together: A Query’s Journey

  1. Your app sends a SELECT via TDS.
  2. The Command Parser validates syntax and builds a query tree.
  3. The Optimizer picks an execution plan using statistics and cost estimates.
  4. The Executor runs the plan, calling into the Storage Engine.
  5. The Buffer Manager checks if needed pages are already in the buffer pool; if not, it fetches them from disk.
  6. If it’s a write, the Log Manager writes the change to the transaction log first (WAL), then the Lock Manager ensures isolation.
  7. Results flow back up through the relational engine and out via TDS to your client.

메타데이터
post_id
fcba1c5eb7c3
slug
understanding-mssql-server-architecture-a-deep-dive-for-dbas-developers-fcba1c5eb7c3
url
https://medium.com/@arjunriocrvr467/understanding-mssql-server-architecture-a-deep-dive-for-dbas-developers-fcba1c5eb7c3
canonical_url
https://medium.com/@arjunriocrvr467/understanding-mssql-server-architecture-a-deep-dive-for-dbas-developers-fcba1c5eb7c3
author_url
https://medium.com/@arjunriocrvr467
status
ok
fetched_at
2026-07-14 10:09:25