top of page

SQL SERVER

Updated: Mar 24, 2023

SQL Server is a relational database management system (RDBMS) developed by Microsoft. It is designed to manage and store large amounts of data efficiently and securely. SQL Server is a powerful tool for managing and analyzing data, and it is widely used in various industries such as finance, healthcare, manufacturing, and e-commerce. In this article, you will learn SQL Server Architecture in detail.


Similar to other RDBMS software, SQL Server is built on top of SQL, a standard programming language for interacting with relational databases. SQL server is tied to Transact-SQL, or T-SQL, Microsoft’s implementation of SQL that adds a set of proprietary programming constructs.


MS SQL Server is a client-server system. When the MS SQL Server process starts, the client application supplies a request. The SQL Server processes the request, responds with processed data, and transmits it back to the client application. There are thousands of records out there, and they are increasing daily. That is why we need an SQL Server database to store them. For starters, however, databases must be managed, and that is where things like the Microsoft SQL Server come into play. The key aspects of SQL Server architecture are addressed in this article. It discusses how MS SQL Server differs from other SQL servers, how Windows SQL Server relates to the topic, and other SQL server issues. Now that we have some definitions, let’s begin with the fundamentals.


SQL Server Architecture


SQL Server Network Interface

SQL Server Network Interface (SNI) is a component of the SQL Server protocol layer that provides communication between client applications and SQL Server instances over a network. It manages the client connections, encrypts and decrypts data, and manages the flow of data between the client and server.


When a client application connects to a server using SSL/TLS, it sends a request to the server indicating the hostname of the server that it is attempting to connect to. In a scenario where a server is hosting multiple SSL/TLS certificates, SNI helps the server identify the correct certificate to use for the client's request.


SNI consists of three primary components:

  1. Network library: The network library is responsible for managing the network protocols used by the client applications to connect to the SQL Server instance. It provides an interface for the client to specify the protocol, IP address, port number, and other connection parameters.

  2. Encryption: Encryption is the process of transforming plain text data into an unreadable format to prevent unauthorized access. SNI provides support for SSL/TLS encryption to secure client-server communication over the network.

  3. Authentication: Authentication is the process of verifying the identity of the client and server to ensure secure communication. SNI supports several authentication protocols, including Kerberos and NTLM.

Without SNI, the server would not know which certificate to use for the connection request, which would result in the connection failing. SNI allows the server to select the appropriate certificate to use for the connection based on the hostname specified in the request, enabling successful connections.


Protocol Layer

The protocol layer is the client-side component of SQL Server architecture, responsible for establishing and managing connections between the client application and the SQL Server. It provides communication between the client and the server using various network protocols, including TCP/IP, Named Pipes, and Shared Memory.


The protocol layer has two main functions: connection management and network communication. Let's take a closer look at each of these functions:

  1. Connection Management: The protocol layer is responsible for managing the connections between the client and the server. When a client application initiates a connection request, the protocol layer verifies the credentials of the user and establishes a secure connection. The protocol layer also manages connection pooling, which allows multiple client connections to share a single physical connection to the server, reducing overhead and improving performance.

  2. Network Communication: The protocol layer provides a mechanism for network communication between the client and the server. It includes several network libraries that implement different network protocols. These libraries are responsible for packaging and transmitting data between the client and the server. The protocol layer also handles error messages and exceptions, ensuring that the client receives appropriate error messages if an error occurs during the communication.

In addition to connection management and network communication, the protocol layer also provides security features to ensure secure communication between the client and the server.


Some of the security features include:

  1. Encryption: The protocol layer supports the encryption of data transmitted between the client and the server, ensuring that sensitive information remains secure during transmission. SQL Server uses the Secure Sockets Layer (SSL) protocol to encrypt data.

  2. Authentication: The protocol layer supports various authentication mechanisms to authenticate the user's credentials. These include Windows authentication, SQL Server authentication, and mixed-mode authentication. Windows authentication relies on the user's Windows login credentials, while SQL Server authentication requires a separate set of credentials specifically for SQL Server.

  3. Authorization: The protocol layer also provides authorization features to restrict access to the SQL Server resources. The authorization ensures that only authorized users can access and modify the data stored in the database.


Relational Engine

The relational engine controls the processing of data by the storage engine and provides the SQL Server components that determine exactly how a query should be performed. The relational engine consists of three main sections: the relational engine, the SQL Server components that govern how the query is executed, and the components that control how it is executed. The relational engine requests data from the storage engine and processes the returned results.


The relational engine and the components that control how it is executed have three main sections:


1. CMD Parser

The role of the Command Parser is to receive and parse incoming SQL commands. When a SQL command is executed, the Command Parser first checks the syntax of the command and then verifies whether the user has the necessary permissions to execute it. It then passes the command to the Query Optimizer for further processing.


2. Query Optimizer

The Query Optimizer is responsible for optimizing SQL queries to ensure efficient and fast retrieval of data. It analyzes the query syntax and the underlying data structure to determine the most efficient method for retrieving the required data. The optimizer generates an execution plan, which outlines the steps required to execute the query. The execution plan is based on a cost-based optimization approach, which considers various factors such as table size, index, and join complexity to determine the most efficient plan.


3. Query Executor

The Query Executor is the final component of the Relational Engine. Its primary role is to execute the optimized query plan generated by the Query Optimizer. The Query Executor communicates with the Storage Engine to retrieve the data and then performs additional processing such as sorting, aggregation, and filtering to produce the final result set. Once the processing is complete, the Query Executor returns the result set to the user.


Storage Engine

The Storage Engine is one of the major components of the SQL Server architecture. Its primary role is to manage the physical storage of data on the disk and maintain its consistency in case of system failures. It is responsible for performing data retrieval and modification, managing memory and disk space, and ensuring data consistency.


There are two types of files in the storage engine:

  1. Data Files

  2. Log Files

Data Files:

Data files are used to store the user data in the database. There are two types of data files used by the SQL Server:

  1. Primary Data File: The primary data file contains the system tables and all other data objects that are not explicitly allocated to any other filegroup. There can be only one primary data file in a database.

  2. Secondary Data File: A secondary data file is any data file that is explicitly created and allocated to a filegroup other than the primary filegroup. A database can have multiple secondary data files.

Log Files:

Log files are used to record all the changes made to the database. They are responsible for maintaining the consistency of the data in case of system failures or errors. There are two types of log files used by the SQL Server:

  1. Transaction Log File: The transaction log file records all the modifications made to the database since the last backup. It contains a record of all the transactions performed on the database, including inserts, updates, and deletes. The transaction log file is essential for recovering the database in case of system failures or errors.

  2. Backup Log File: The backup log file is a file that is used to store the transaction log records during a backup operation. It allows for the transaction log to be backed up independently from the data files.


The Storage Engine comprises several sub-components, including the Access Method, Buffer Manager, and Transaction Manager.


1. Access method

The Access Method is responsible for managing the storage of data on the disk and retrieving it when requested by the Relational Engine. It uses data structures such as B-trees and heaps to organize and retrieve data from the disk efficiently. It also manages the index data structures to optimize data retrieval operations, such as scans and seeks. The Access Method is responsible for locking the data pages during data retrieval and modification to ensure data consistency and prevent data loss.


2. Buffer Manager

The Buffer Manager is responsible for managing the memory that is used to cache data pages. It retrieves data pages from the disk and stores them in memory for faster data retrieval. The Buffer Manager also implements a replacement policy to ensure that the most frequently used data pages are kept in memory to optimize data retrieval performance. It also manages the buffer pool, which is the memory area where data pages are stored, and controls the allocation of memory to different components of the SQL Server.


3. Transaction Manager

The Transaction Manager is responsible for ensuring the consistency of data in case of system failures or errors. It manages the transactions that modify the data in the database and maintains a log of all the changes made to the data. The Transaction Manager uses the log to recover the database in case of a system failure or error. It also ensures the consistency of the data by using a set of rules known as the ACID properties (Atomicity, Consistency, Isolation, Durability).


Advantages of SQL Server

1. Easy Installation and Configuration: SQL Server is simple to install and requires minimal command-line configuration compared to other database servers. The setup wizard enables one-click installation of Microsoft SQL, and the installation guide is clear and includes a lot of instructions, making this a convenient experience. The software updates are downloaded by the setup wizard, which reduces manual labor. As a result, the database remains current and maintenance costs are reduced. Analytical and database capabilities can be added at a later date.


2. Instance-Based Licensing: When you purchase an SQL Server license, instances help reduce the costs of operating the server. Users receive different services from different instances, so there is no need to purchase one license for all services.


3. Enhanced Performance: SQL Server provides enhanced performance thanks to built-in transparent data compression and encryption capabilities. SQL Server permits users to effectively manage the security of sensitive business data by offering efficient permission controls. Because the data must not be modified in order to secure and encrypt it, the SQL Server provides efficient permission controls.


4. Editions: A corporate enterprise or domestic and remote users can select the edition that meets their requirements. There are several editions that cater to the needs of corporate enterprises and remote and domestic users, and they differ in terms of features and price levels. Therefore, organizations can determine whether or not they want to use a particular version.


5. High Security: The SQL Server database is extremely secure, using advanced encryption algorithms that virtually make it impossible to break the security barriers. SQL Server, a commercial relational database with additional security features, reduces the risk of attacks.


6. High Availability: An SQL Server service outage can result in a service slowdown if a failed instance is left in production. However, if a standby server is in use, you will be kept up to date with any failed server. SQL Server instances can be used to achieve this service level.


7. Advanced Recovery Tools: With the help of advanced recovery tools, it’s possible to recover the entire database. SQL Server is a combination of several sophisticated features that assist in recovering lost or damaged data. Data storage and related processes are tightly controlled by the Database Engine, which includes both a core component and a slew of facilities.


8. Data-Management Tools: SQL Server’s data-management tools, such as effective data mining, disk partitioning, and data management, help ensure that critical data is preserved and sufficient storage space is available for high-risk information.

0 comments
bottom of page