0% found this document useful (0 votes)
2K views

SQL Server Architecture - PPT

The document provides an overview of the SQL Server architecture, which follows a client/server model. It describes the key components of the SQL Server architecture including the protocol layer (SNI), relational engine, storage engine, and SQL OS. The relational engine handles query parsing, optimization, and execution. The storage engine manages storage, retrieval, and locking of data on disk. The document also discusses the ACID properties, write-ahead logging, checkpoint process, and lazywriter process that are important aspects of SQL Server.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

SQL Server Architecture - PPT

The document provides an overview of the SQL Server architecture, which follows a client/server model. It describes the key components of the SQL Server architecture including the protocol layer (SNI), relational engine, storage engine, and SQL OS. The relational engine handles query parsing, optimization, and execution. The storage engine manages storage, retrieval, and locking of data on disk. The document also discusses the ACID properties, write-ahead logging, checkpoint process, and lazywriter process that are important aspects of SQL Server.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

SQL SERVER ARCHITECTURE

Date:- 02nd July 2017


by SQL SERVER HUNTERS
Agenda
• What is meant by Client/Server Architecture
• SQL Server Detailed Architecture
 SNI
 Relational Engine
 Storage Engine
 SQL OS
• ACID Properties
• Write Ahead Logging
• Checkpoint Process
• Lazywriter process
What is the Client/Server Architecture?
• SQL server Follows Client/Server Architecture
• Clients are PCs or Workstations on which users run applications.
• Server is one or more multi-user processors with share memory
providing computing, connectivity and the database services and the
interfaces relevant to the business need.

Database
Client Application
SQL Server or
Desktop/Browser .NET/Java
Oracle
SQL Server Detailed Architecture
SNI
• The protocol layer receives the requests from client and translates it
into a form that the relational engine can work with.

• When an application communicates with the Database Engine, the


application programming interfaces (APIs) exposed by the protocol
layer formats the communication using a Microsoft-defined format
called a tabular data stream (TDS) packet.

– Shared Memory - Shared Memory protocol can connect to only a SQL Server
instance running on the same computer.
– Named Pipes-A protocol developed for local area networks (LAN).
– TCP/IP--TCP/IP can communicate across interconnected computer networks with
diverse hardware architectures and operating systems.
The Relational Engine
• The Relational Engine is also sometimes called the query
processor because its primary function is query optimization
and execution. It contains

– Command Parser to check query syntax and prepare query trees.


– Query Optimizer that is arguably the crown jewel of any database
system.
– Query Executor responsible for execution.

• Communication between the Relational Engine and the


storage engine is generally in terms of Object Linking and
Embedding (OLE) DB rowsets. (Rowset is the OLE DB term for
a result set.)
Command (or) Query Parser
Checks the query to make sure that its syntax is valid. If the query has a syntax error, the
error is returned to the client through protocol layer. If the query syntax is valid, the
command parser generates a parse tree and give it to algebrizer.

Algebrizer primary function is to perform binding, which means validating whether the
tables and columns used in the query exist, loading the metadata information for the
tables and columns, identifying all data types used for the query

After a query is parsed, a binding component performs name resolution to convert the
object names into their unique object ID values.

After the parsing and binding is done, the command is converted into an internal format
that can be operated on. This internal format is known as a query tree.
Query Optimizer

DML statements INSERT, UPDATE,


DELETE, and MERGE, which can be
processed in more than one way;

Query Optimizer Takes the ALGEBRIZER output as input and


by using the query statistics will prepare the east expensive
query planin terms of the required CPU processing and I/O.

Execution plan is like a roadmap, which


contains the order of all the steps to be
performed as part of the query execution.
Query Executor
• This is where the query will be executed step by step with
the help of execution plan given by Query Optimizer and will
contact the storage engine to get the Required Data.
• This acts as a dispatcher for all commands in the execution
plan.
• This module goes through each command of the execution
plan until the batch is complete.
The Storage Engine

• It is responsible for storage and retrieval of data on the


storage system (disk, SAN, etc.,), data manipulation, locking
and managing transactions and it contains

– Access Methods code, which handles I/O requests for rows, indexes,
pages, allocations and row versions.
– Buffer Manager, which deals with SQL Server’s main memory
consumer, the buffer pool.
– Transaction Manager, which handles the locking of data to maintain
Isolation (ACID properties) and manages the transaction log.
Access Methods

• Access Methods is a collection of code that provides the


storage structures for data and indexes as well as the
interface through which data is retrieved and modified.

• It contains all the code to retrieve data but it doesn’t actually


perform the operation itself; it passes the request to the
Buffer Manager, which ultimately serves up the page in its
cache or reads it to cache from disk.
Buffer Manager and Buffer Pool
• The Buffer Manager manages the buffer pool, which
represents the majority of SQL Server’s memory usage.
• The buffer pool is a place where data is written temporarily.
– Data Cache: This is the place that every data page that is read from
disk is written to before being used.
– Plan Cache: This is the place used to store execution plans in case
they are needed later.
Transaction manager

• The Transaction manager manages the Log file when the


request is DML. It has two components.
– Lock Manager: The Lock Manager is responsible for providing
concurrency to the data, and it delivers the configured level of
isolation by using locks.
– Log Manager: Log Manager writes the changes to the transaction log.
This is called Write-Ahead Logging.
SQL OS

• This lies between the host machine (Windows OS) and SQL
Server. All the activities performed on database engine are
taken care of by SQL OS.

• SQL OS provides various operating system services, such as


memory management deals with buffer pool, log buffer and
deadlock detection using the blocking and locking structure.
ACID Properties
A-Atomicity
All or Nothings Transactions

C- Consistency
Guarantees Committed State

I- Isolation
Transactions are Independent

D- Durability
Committed data Never Lost
WAL
• SQL Server uses a write-ahead log (WAL), before committing in
MDF, every transaction should write an entry in LOG file.
Checkpoint
• A checkpoint writes the current in-memory modified pages (known as dirty
pages) and transaction log information from memory to disk and, also, records
information about the transaction log since last Checkpoint.

– Helps in speeding up the Recovery process


– Helps in committing data permanently.

• Types of Checkpoints
– Automatic
– Indirect
– Manual
– Internal
Lazy Writer

• The lazy writer is a system process that keeps free buffers


available by removing infrequently used pages from the buffer
cache. Dirty pages are first written to disk.

• Total number of pages that lazy writer releases can be higher


than the number of pages lazy writer writes to the data files.
Any Questions?
Thanks

You might also like