SlideShare a Scribd company logo
Sql architecture
The Relational and Storage
Engines
•The relational engine comprises all the components necessary
to parse and optimize any query
•It also manages the execution of queries as it requests data
from the storage engine in terms of OLE DB row sets and then
processes the row sets returned. (Row set is the OLE DB term
for a result set.)
•The storage engine comprises the components needed to
actually access and modify data on disk.
SQL Manager
The SQL manager is responsible for everything having to
do with managing stored procedures and their plans. It
determines when a stored procedure needs recompilation
based on changes in the underlying objects' schemas, and
it manages the caching of procedure plans so that other
processes can reuse them.
Checkpoints
•Checkpoints are run on a database-by-database basis.
•They flush dirty pages from the current database out to disk
so that those changes don't have to be redone during database
recovery.
•A dirty page is one that has been modified since it was
brought from disk into the buffer pool.
•When a checkpoint occurs, SQL Server writes a checkpoint
record to the transaction log, which lists all the transactions
that are active
•This allows the recovery process to build a table containing a
list of all the potentially dirty pages.
Roll back / Forward
Transaction Logging and
Recovery
•Recovery performs both redo (rollforward) and undo (rollback)
operations
•If the change doesn't appear in the database, it is again performed
from the information in the log
•Undo requires the removal of partial changes made by a
transaction if the transaction did not entirely complete
Three phases to the recovery
algorithm
•Phase 1: Analysis, Phase 2: Redo, Phase 3: Undo
Phase 1: Analysis
•The first phase is a forward pass starting at the last
checkpoint record in the transaction log.
•This pass determines and constructs a dirty page table (DPT)
consisting of pages that might have been dirty at the time of
the crash (or when SQL Server stopped)
•An active transaction table is built that consists of
uncommitted transactions at the time of the crash
Phase 2: Redo
•This phase repeats history by returning the database to the state it
was in at the time of the crash
•The starting point for this forward pass is the minimum of all the
LSNs (Log sequence number) in the DPT (dirty page table)
•. The DPT is used to avoid reading pages that don't need
recovering and to avoid overwriting nonlogged changes
Phase 3: Undo
•This phase moves backward from the end of the log
•Any transaction that was not committed at the time of the
crash is undone so that none of its changes are actually
reflected in the database.
Locking and Transaction
•A transaction can be rolled back only if all affected data was
locked exclusively so that no other process could have made
changes to resources used by the transaction that would prevent its
being rolled back.
•Only one active transaction can modify a row at a time
•This is why exclusive locks must be held until a transaction is
either committed or aborted.
Interaction with the Operating
System
•The SQL Server kernel is responsible for interacting with the
operating system
•All requests to operating system services are made via the
Win32 API and C run-time libraries.
Threading
•SQL Server supports multiprocessing at the thread level rather
than at the process level, which allows for preemptive operation
and dynamic load balancing across multiple CPUs. Using
multiple threads is significantly more efficient than using
multiple processes.

More Related Content

PPTX
Microsoft sql server architecture
PPTX
Sql server backup internals
PPTX
Sql server logshipping
PPT
Sql server performance tuning and optimization
PPT
Sql Server Performance Tuning
PDF
SQL Server Tuning to Improve Database Performance
PDF
SQL Server Query Tuning Tips - Get it Right the First Time
PPTX
Sql Server
Microsoft sql server architecture
Sql server backup internals
Sql server logshipping
Sql server performance tuning and optimization
Sql Server Performance Tuning
SQL Server Tuning to Improve Database Performance
SQL Server Query Tuning Tips - Get it Right the First Time
Sql Server

What's hot (15)

PDF
Enteros StarWest 2012 - Database load testing
PPT
Sql server performance tuning
PDF
Performance tuning in sql server
PDF
Difference between sql server 2008 and sql server 2012
PDF
Why & how to optimize sql server for performance from design to query
PDF
SQL Server Performance Tuning Baseline
PPTX
Oracle Database 12c - Features for Big Data
PDF
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PPTX
Ten query tuning techniques every SQL Server programmer should know
PPTX
Database Performance Tuning
PPTX
Sql server performance tuning
PPTX
Oracle performance tuning_sfsf
PDF
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PPTX
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
PPSX
Oracle database 12c new features
Enteros StarWest 2012 - Database load testing
Sql server performance tuning
Performance tuning in sql server
Difference between sql server 2008 and sql server 2012
Why & how to optimize sql server for performance from design to query
SQL Server Performance Tuning Baseline
Oracle Database 12c - Features for Big Data
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
Ten query tuning techniques every SQL Server programmer should know
Database Performance Tuning
Sql server performance tuning
Oracle performance tuning_sfsf
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle database 12c new features
Ad

Viewers also liked (20)

PPTX
Physical architecture of sql server
PPT
Ms sql server architecture
PPTX
Microsoft SQL Server internals & architecture
PDF
MS-SQL SERVER ARCHITECTURE
PPTX
MS Sql Server: Introduction To Database Concepts
PPT
Sql Server Basics
PPTX
Sql server basics
PPTX
Sql Server 2012
PPTX
CSharp Presentation
PPSX
Memory management in sql server
PDF
Руководство по SQL Server 2012: Многомерное моделирование шаг за шагом.
PPTX
MS SQL SERVER: Getting Started With Sql Server 2008
PPT
New features of sql server 2005
PDF
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
PPTX
SQL Server Query Optimization, Execution and Debugging Query Performance
PPTX
SQL Server 2016 New Features and Enhancements
PPTX
End-to-end Troubleshooting Checklist for Microsoft SQL Server
PDF
Sql server 2016 new features
PPTX
SQL Server Reporting Services 2008
PPTX
Introduction to SQL Server Internals: How to Think Like the Engine
Physical architecture of sql server
Ms sql server architecture
Microsoft SQL Server internals & architecture
MS-SQL SERVER ARCHITECTURE
MS Sql Server: Introduction To Database Concepts
Sql Server Basics
Sql server basics
Sql Server 2012
CSharp Presentation
Memory management in sql server
Руководство по SQL Server 2012: Многомерное моделирование шаг за шагом.
MS SQL SERVER: Getting Started With Sql Server 2008
New features of sql server 2005
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server 2016 New Features and Enhancements
End-to-end Troubleshooting Checklist for Microsoft SQL Server
Sql server 2016 new features
SQL Server Reporting Services 2008
Introduction to SQL Server Internals: How to Think Like the Engine
Ad

Similar to Sql architecture (20)

PPT
Unit-V Recovery software wngineering should learn software
PPTX
Transaction processing
PPT
DBMS CIIT Ch8.pptasddddddddddddddddddddd
PPT
DBMS CIIT Ch8.pptasddddddddddddddddddddd
PDF
Advanced database chapter three PowerPoint
PPTX
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
PPTX
DBMS-Module - 5 updated1onestructure of database.pptx
PPTX
UNIT-4-Transactionstates and processing ppt.pptx
PPT
transaction_processing.ppt
PPT
Transaction management and concurrency control
PPTX
515689311-Postgresql-DBA-Architecture.pptx
PPT
Taking Full Advantage of Galera Multi Master Cluster
PDF
Database recovery techniques
PPTX
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
PPTX
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
PPTX
Postgresql Database Administration Basic - Day1
PPTX
7. transaction mang
PDF
DBMS Vardhaman.pdf
DOCX
Algorithm for Recovery and Isolation Exploiting Semantics (ARIES)
PDF
IBM Tivoli Storage Manager V6 - PCTY 2011
Unit-V Recovery software wngineering should learn software
Transaction processing
DBMS CIIT Ch8.pptasddddddddddddddddddddd
DBMS CIIT Ch8.pptasddddddddddddddddddddd
Advanced database chapter three PowerPoint
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
DBMS-Module - 5 updated1onestructure of database.pptx
UNIT-4-Transactionstates and processing ppt.pptx
transaction_processing.ppt
Transaction management and concurrency control
515689311-Postgresql-DBA-Architecture.pptx
Taking Full Advantage of Galera Multi Master Cluster
Database recovery techniques
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
TRANSACTION MANAGEMENT PROCESSING DBMS(5)
Postgresql Database Administration Basic - Day1
7. transaction mang
DBMS Vardhaman.pdf
Algorithm for Recovery and Isolation Exploiting Semantics (ARIES)
IBM Tivoli Storage Manager V6 - PCTY 2011

More from rchakra (12)

PPTX
Requirement management presentation to a software team
PPT
Subversion client
PPT
Subversion
PPT
Sql 2005 the ranking functions
PPT
Sql basics 2
PPT
T-Sql basics
PPT
Introduction to ADO.NET
PPTX
Intro to Microsoft.NET
PPT
Object oriented programming systems
PPT
Subversion Admin
PPT
Intro to UML 2
PPT
Intro To .Net Threads
Requirement management presentation to a software team
Subversion client
Subversion
Sql 2005 the ranking functions
Sql basics 2
T-Sql basics
Introduction to ADO.NET
Intro to Microsoft.NET
Object oriented programming systems
Subversion Admin
Intro to UML 2
Intro To .Net Threads

Sql architecture

  • 2. The Relational and Storage Engines •The relational engine comprises all the components necessary to parse and optimize any query •It also manages the execution of queries as it requests data from the storage engine in terms of OLE DB row sets and then processes the row sets returned. (Row set is the OLE DB term for a result set.) •The storage engine comprises the components needed to actually access and modify data on disk.
  • 3. SQL Manager The SQL manager is responsible for everything having to do with managing stored procedures and their plans. It determines when a stored procedure needs recompilation based on changes in the underlying objects' schemas, and it manages the caching of procedure plans so that other processes can reuse them.
  • 4. Checkpoints •Checkpoints are run on a database-by-database basis. •They flush dirty pages from the current database out to disk so that those changes don't have to be redone during database recovery. •A dirty page is one that has been modified since it was brought from disk into the buffer pool. •When a checkpoint occurs, SQL Server writes a checkpoint record to the transaction log, which lists all the transactions that are active •This allows the recovery process to build a table containing a list of all the potentially dirty pages.
  • 5. Roll back / Forward
  • 6. Transaction Logging and Recovery •Recovery performs both redo (rollforward) and undo (rollback) operations •If the change doesn't appear in the database, it is again performed from the information in the log •Undo requires the removal of partial changes made by a transaction if the transaction did not entirely complete
  • 7. Three phases to the recovery algorithm •Phase 1: Analysis, Phase 2: Redo, Phase 3: Undo
  • 8. Phase 1: Analysis •The first phase is a forward pass starting at the last checkpoint record in the transaction log. •This pass determines and constructs a dirty page table (DPT) consisting of pages that might have been dirty at the time of the crash (or when SQL Server stopped) •An active transaction table is built that consists of uncommitted transactions at the time of the crash
  • 9. Phase 2: Redo •This phase repeats history by returning the database to the state it was in at the time of the crash •The starting point for this forward pass is the minimum of all the LSNs (Log sequence number) in the DPT (dirty page table) •. The DPT is used to avoid reading pages that don't need recovering and to avoid overwriting nonlogged changes
  • 10. Phase 3: Undo •This phase moves backward from the end of the log •Any transaction that was not committed at the time of the crash is undone so that none of its changes are actually reflected in the database.
  • 11. Locking and Transaction •A transaction can be rolled back only if all affected data was locked exclusively so that no other process could have made changes to resources used by the transaction that would prevent its being rolled back. •Only one active transaction can modify a row at a time •This is why exclusive locks must be held until a transaction is either committed or aborted.
  • 12. Interaction with the Operating System •The SQL Server kernel is responsible for interacting with the operating system •All requests to operating system services are made via the Win32 API and C run-time libraries.
  • 13. Threading •SQL Server supports multiprocessing at the thread level rather than at the process level, which allows for preemptive operation and dynamic load balancing across multiple CPUs. Using multiple threads is significantly more efficient than using multiple processes.