SlideShare ist ein Scribd-Unternehmen logo
1 von 13
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.

Weitere ähnliche Inhalte

Was ist angesagt?

Enteros StarWest 2012 - Database load testing
Enteros StarWest 2012 - Database load testing Enteros StarWest 2012 - Database load testing
Enteros StarWest 2012 - Database load testing ronwarshawsky
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningngupt28
 
Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012Umar Ali
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryWhy & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryAntonios Chatzipavlis
 
SQL Server Performance Tuning Baseline
SQL Server Performance Tuning BaselineSQL Server Performance Tuning Baseline
SQL Server Performance Tuning Baseline► Supreme Mandal ◄
 
Oracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big DataOracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big DataAbishek V S
 
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorPGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorEqunix Business Solutions
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowKevin Kline
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning Arno Huetter
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningJugal Shah
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsfMao Geng
 
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldPGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldEqunix Business Solutions
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...Alex Zaballa
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new featuresRemote DBA Services
 

Was ist angesagt? (15)

Enteros StarWest 2012 - Database load testing
Enteros StarWest 2012 - Database load testing Enteros StarWest 2012 - Database load testing
Enteros StarWest 2012 - Database load testing
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryWhy & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to query
 
SQL Server Performance Tuning Baseline
SQL Server Performance Tuning BaselineSQL Server Performance Tuning Baseline
SQL Server Performance Tuning Baseline
 
Oracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big DataOracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big Data
 
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorPGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
 
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldPGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
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 Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 

Andere mochten auch

Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql serverDivya Sharma
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architectureAjeet Singh
 
Microsoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureMicrosoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureKevin Kline
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsDataminingTools Inc
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp PresentationVishwa Mohan
 
Memory management in sql server
Memory management in sql serverMemory management in sql server
Memory management in sql serverPrashant Kumar
 
Руководство по SQL Server 2012: Многомерное моделирование шаг за шагом.
Руководство по SQL Server 2012: Многомерное моделирование шаг за шагом.Руководство по SQL Server 2012: Многомерное моделирование шаг за шагом.
Руководство по SQL Server 2012: Многомерное моделирование шаг за шагом.Компания Робот Икс
 
MS SQL SERVER: Getting Started With Sql Server 2008
MS SQL SERVER: Getting Started With Sql Server 2008MS SQL SERVER: Getting Started With Sql Server 2008
MS SQL SERVER: Getting Started With Sql Server 2008sqlserver content
 
New features of sql server 2005
New features of sql server 2005New features of sql server 2005
New features of sql server 2005Govind Raj
 
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server AlwaysOn for Dummies SQLSaturday #202 EditionSQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
SQL Server AlwaysOn for Dummies SQLSaturday #202 EditionMark Broadbent
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceVinod Kumar
 
SQL Server 2016 New Features and Enhancements
SQL Server 2016 New Features and EnhancementsSQL Server 2016 New Features and Enhancements
SQL Server 2016 New Features and EnhancementsJohn Martin
 
End-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerEnd-to-end Troubleshooting Checklist for Microsoft SQL Server
End-to-end Troubleshooting Checklist for Microsoft SQL ServerKevin Kline
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new featuresAjeet Singh
 
SQL Server Reporting Services 2008
SQL Server Reporting Services 2008SQL Server Reporting Services 2008
SQL Server Reporting Services 2008VishalJharwade
 
Introduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the EngineIntroduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the EngineBrent Ozar
 

Andere mochten auch (20)

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

Ähnlich wie Sql architecture

Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...Lucas Jellema
 
Transaction management and concurrency control
Transaction management and concurrency controlTransaction management and concurrency control
Transaction management and concurrency controlDhani Ahmad
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniquespusp220
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxKoteswari Kasireddy
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1PoguttuezhiniVP
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mangkhoahuy82
 
IBM Tivoli Storage Manager V6 - PCTY 2011
IBM Tivoli Storage Manager V6 - PCTY 2011IBM Tivoli Storage Manager V6 - PCTY 2011
IBM Tivoli Storage Manager V6 - PCTY 2011IBM Sverige
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and RecoveryMaham Huda
 
Microsoft Hekaton
Microsoft HekatonMicrosoft Hekaton
Microsoft HekatonSiraj Memon
 
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1sunildupakuntla
 
8. transactions
8. transactions8. transactions
8. transactionsAmrit Kaur
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptAdemeCheklie
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersShehap Elnagar
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersShehap Elnagar
 

Ähnlich wie Sql architecture (20)

Transaction processing
Transaction processingTransaction processing
Transaction processing
 
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
 
transaction_processing.ppt
transaction_processing.ppttransaction_processing.ppt
transaction_processing.ppt
 
Transaction management and concurrency control
Transaction management and concurrency controlTransaction management and concurrency control
Transaction management and concurrency control
 
Taking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master ClusterTaking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master Cluster
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptxUnit 4 chapter - 8 Transaction processing Concepts (1).pptx
Unit 4 chapter - 8 Transaction processing Concepts (1).pptx
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mang
 
DBMS Vardhaman.pdf
DBMS Vardhaman.pdfDBMS Vardhaman.pdf
DBMS Vardhaman.pdf
 
IBM Tivoli Storage Manager V6 - PCTY 2011
IBM Tivoli Storage Manager V6 - PCTY 2011IBM Tivoli Storage Manager V6 - PCTY 2011
IBM Tivoli Storage Manager V6 - PCTY 2011
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
Microsoft Hekaton
Microsoft HekatonMicrosoft Hekaton
Microsoft Hekaton
 
DBMS 4.pdf
DBMS 4.pdfDBMS 4.pdf
DBMS 4.pdf
 
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
DB2 LUW V11.1 CERTIFICATION TRAINING PART #1
 
8. transactions
8. transactions8. transactions
8. transactions
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
 

Mehr von rchakra

Requirement management presentation to a software team
Requirement management presentation to a software teamRequirement management presentation to a software team
Requirement management presentation to a software teamrchakra
 
Subversion client
Subversion clientSubversion client
Subversion clientrchakra
 
Subversion
SubversionSubversion
Subversionrchakra
 
Sql 2005 the ranking functions
Sql 2005   the ranking functionsSql 2005   the ranking functions
Sql 2005 the ranking functionsrchakra
 
Sql basics 2
Sql basics 2Sql basics 2
Sql basics 2rchakra
 
T-Sql basics
T-Sql basicsT-Sql basics
T-Sql basicsrchakra
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NETrchakra
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET rchakra
 
Object oriented programming systems
Object oriented programming systemsObject oriented programming systems
Object oriented programming systemsrchakra
 
Subversion Admin
Subversion AdminSubversion Admin
Subversion Adminrchakra
 
Intro to UML 2
Intro to UML 2Intro to UML 2
Intro to UML 2rchakra
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threadsrchakra
 

Mehr von rchakra (12)

Requirement management presentation to a software team
Requirement management presentation to a software teamRequirement management presentation to a software team
Requirement management presentation to a software team
 
Subversion client
Subversion clientSubversion client
Subversion client
 
Subversion
SubversionSubversion
Subversion
 
Sql 2005 the ranking functions
Sql 2005   the ranking functionsSql 2005   the ranking functions
Sql 2005 the ranking functions
 
Sql basics 2
Sql basics 2Sql basics 2
Sql basics 2
 
T-Sql basics
T-Sql basicsT-Sql basics
T-Sql basics
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET
 
Object oriented programming systems
Object oriented programming systemsObject oriented programming systems
Object oriented programming systems
 
Subversion Admin
Subversion AdminSubversion Admin
Subversion Admin
 
Intro to UML 2
Intro to UML 2Intro to UML 2
Intro to UML 2
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threads
 

Sql architecture

  • 1.
  • 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.