Friday, 10 May 2013

BRIEF OF SQL SERVER ARCHITECTURE




 
We can define SQL server architecture comprises of three layers as follows

1.      Query processor (Shown at the top)
2.      Storage engine   (Shown in the middle)
3.      SQL OS                   (Shown at the bottom)


1.      Query Processor:  As the name justifies this layer determines that how does query going to be execute and the best optimized way to execute it. It communicates with middle layer(Storage engine) to access and manipulate data. Following are the different task of query processor.

1a. Parser
                  1b. Optimizer
                    1c. SQL Manager
                    1d. Database Manager
                    1e. Query Executor

 

2.      Storage engine: This engine is responsible for storage and retrieval of data on hard        drive. SQL server needs to keep it data somewhere physically on the drive for anytime data use. SQL server populates data basically in files one is MDF( metadata file) and another is LDF (Log data File). These datafile and logfile further store data into more logical granular unit are called Pages . Pages which stores data called datapages.

 
                  1 PAGE = 8KB

1 EXTEND= 8 PAGES = 64 KB

 

Each page begins with a 96-byte header that is used to store system information about the page. This information includes the page number, page type, the amount of free space on the page, and the allocation unit ID of the object that owns the page.

The following table shows the page types used in the data files of a SQL Server database.

Page type
Contents
 
Data
Data rows with all data, except text, ntext, image, nvarchar(max), varchar(max), varbinary(max), and xml data, when text in row is set to ON.
 
Index
Index entries.
 
Text/Image
Large object data types:
  • text, ntext, image, nvarchar(max), varchar(max), varbinary(max), and xml data
Variable length columns when the data row exceeds 8 KB:
  • varchar, nvarchar, varbinary, and sql_variant
 
Global Allocation Map, Shared Global Allocation Map
Information about whether extents are allocated.
 
Page Free Space
Information about page allocation and free space available on pages.
 
Index Allocation Map
Information about extents used by a table or index per allocation unit.
 
Bulk Changed Map
Information about extents modified by bulk operations since the last BACKUP LOG statement per allocation unit.
 
Differential Changed Map
Information about extents that have changed since the last BACKUP DATABASE statement per allocation unit.
 
 
Note: Log files do not contain pages; they contain a series of log records.

 
3.      SQL OS: This is the powerful OS which is responsible for all kind of activities to database management. It has Monitors, writers ,Memory manager, lock manager, buffer pool, synchronization services and IO.

 

No comments:

Post a Comment