The major components of SQL Server
are:
1.
Relational Engine
2.
Storage Engine
3.
SQL OS
Now we will discuss and understand
each one of them.
1) Relational Engine:
Also called as the query processor, Relational Engine includes the components
of SQL Server that determine what your query exactly needs to do and the best
way to do it. It manages the execution of queries as it requests data from the
storage engine and processes the results returned.
Different Tasks of Relational
Engine:
1.
Query Processing
2.
Memory Management
3.
Thread and Task Management
4.
Buffer Management
5.
Distributed Query Processing
2) Storage Engine:
Storage Engine is responsible for storage and retrieval of the data on
to the storage system (Disk, SAN etc.). to understand more,
let’s focus on the concepts. When we talk about any database in SQL server,
there are 2 types of files that are created at the disk level – Data
file and Log file. Data file physically stores the data in data pages. Log
files that are also known as write ahead logs, are used for storing transactions
performed on the database.
Let’s understand data file and log
file in more details:
Data File: Data File stores data in the form
of Data Page (8KB) and these data pages are logically
organized in extents.
Extents: Extents are logical units in the database. They are a
combination of 8 data pages i.e. 64 KB forms an extent. Extents can be of two
types, Mixed and Uniform. Mixed extents hold different types of pages like
index, system, data etc (multiple objects). On the other hand, Uniform
extents are dedicated to only one type (object).
Pages: As we should know what type of data pages can be stored in
SQL Server, below mentioned are some of them:
- Data Page: It holds the data
entered by the user but not the data which is of type
text, ntext, nvarchar(max), varchar(max), varbinary(max),
image and xml data.
- Index: It stores the index
entries.
- Text/Image: It stores LOB (
Large Object data) like text, ntext, varchar(max),
nvarchar(max), varbinary(max), image and xml data.
- GAM & SGAM (Global
Allocation Map & Shared Global Allocation Map): They are used for
saving information related to the allocation of extents.
- PFS (Page Free Space):
Information related to page allocation and unused space available
on pages.
- IAM (Index Allocation Map):
Information pertaining to extents that are used by a table or index per
allocation unit.
- BCM (Bulk Changed Map): Keeps
information about the extents changed in a Bulk Operation.
- DCM (Differential Change Map):
This is the information of extents that have modified since the last
BACKUP DATABASE statement as per allocation unit.
Log File: It also known as write ahead log. It stores
modification to the database (DML and DDL).
·
Sufficient information is logged to
be able to:
o
Roll back transactions if requested
o
Recover the database in case of
failure
o
Write Ahead Logging is used to
create log entries
§
Transaction logs are written in
chronological order in a circular way
§
Truncation policy for logs is based
on the recovery model
3) 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. It is a highly
configurable operating system with powerful API (application programming
interface), enabling automatic locality and advanced parallelism. 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. Other services include exception handling, hosting for
external components like Common Language Runtime, CLR etc.
No comments:
Post a Comment