SlideShare una empresa de Scribd logo
1 de 15
Microsoft SQL Server: The Transaction Log and why you should care about VLF’s Level 400 Presented By: Stephan Lawson SQL DBA
[object Object],Managing large SQL environment. Large scale migrations, consolidated environments. Performance Tuning and Optimization. ,[object Object]
Blogger at lessthandot.comSQLArcher About Me
[object Object]
One or many, does it make a difference?
Can the T-Log be optimized? Diving into the colourful world of Virtual Log Files.
Demo
Resources/LinksOverview:
The transaction log, or T-Log, is a record of all transactions happening to the database. All these transactions are actually first written to the log, and then after a checkpoint, is written to the data file via the lazy writer. Main use: ,[object Object]
Start and end of each transaction.
Every data modification(insert, update, delete) including system SP’s, DDL statements to any table including system tables.
Every extent and page allocation and de-allocation.
Creating or dropping tables and indexes.What is a transaction log?
SQL Server uses a write-ahead log, this guarantees that no data modifications is written to the disk before the associated log record is written to disk. This maintains the ACID properties of a transaction. So this is how it works: How does it work?
Unlike TempDB which benefits from having multiple data files, the T-Log does not; it only serves as redundancy. The T-Log is written to sequentially and in a round-robin fashion. Example; you create 3 T-logs for a database: One or many, does it matter? T1 T2 T3

Más contenido relacionado

La actualidad más candente

Mulesoft vm transport reference
Mulesoft vm transport referenceMulesoft vm transport reference
Mulesoft vm transport referencekumar gaurav
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in muleAnirban Sen Chowdhary
 
State of the CLI- Kat Marchan
State of the CLI- Kat MarchanState of the CLI- Kat Marchan
State of the CLI- Kat MarchanNodejsFoundation
 
Reactive programming
Reactive programmingReactive programming
Reactive programmingsaykopatt
 
3.2 Streaming and Messaging
3.2 Streaming and Messaging3.2 Streaming and Messaging
3.2 Streaming and Messaging振东 刘
 
Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...
Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...
Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...Codemotion
 
MySQL X protocol - Talking to MySQL Directly over the Wire
MySQL X protocol - Talking to MySQL Directly over the WireMySQL X protocol - Talking to MySQL Directly over the Wire
MySQL X protocol - Talking to MySQL Directly over the WireSimon J Mudd
 
Soap In Mule
Soap In MuleSoap In Mule
Soap In MuleBui Kiet
 
Async Scope With Mule ESB
Async Scope With Mule ESBAsync Scope With Mule ESB
Async Scope With Mule ESBJitendra Bafna
 
2.2 Reliable Message Bus based on RocketMQ
2.2 Reliable Message Bus based on RocketMQ2.2 Reliable Message Bus based on RocketMQ
2.2 Reliable Message Bus based on RocketMQ振东 刘
 
New Xcede - the ultimate reporting tool for Reckon APS suite
New Xcede - the ultimate reporting tool for Reckon APS suiteNew Xcede - the ultimate reporting tool for Reckon APS suite
New Xcede - the ultimate reporting tool for Reckon APS suiteReckon
 
Composite source in bound and out-bound
Composite source in bound and out-boundComposite source in bound and out-bound
Composite source in bound and out-boundSon Nguyen
 
Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Gerard Klijs
 
Building and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemBuilding and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemKapil Reddy
 
Clustering and load balancing : jboss
Clustering and load balancing : jbossClustering and load balancing : jboss
Clustering and load balancing : jbossLalit Shaktawat
 

La actualidad más candente (20)

Mulesoft vm transport reference
Mulesoft vm transport referenceMulesoft vm transport reference
Mulesoft vm transport reference
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in mule
 
NSF to PST
NSF to PSTNSF to PST
NSF to PST
 
State of the CLI- Kat Marchan
State of the CLI- Kat MarchanState of the CLI- Kat Marchan
State of the CLI- Kat Marchan
 
Reactive programming
Reactive programmingReactive programming
Reactive programming
 
3.2 Streaming and Messaging
3.2 Streaming and Messaging3.2 Streaming and Messaging
3.2 Streaming and Messaging
 
Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...
Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...
Distributed System explained (with NodeJS) - Bruno Bossola - Codemotion Milan...
 
MySQL X protocol - Talking to MySQL Directly over the Wire
MySQL X protocol - Talking to MySQL Directly over the WireMySQL X protocol - Talking to MySQL Directly over the Wire
MySQL X protocol - Talking to MySQL Directly over the Wire
 
Soap In Mule
Soap In MuleSoap In Mule
Soap In Mule
 
Time Machine
Time MachineTime Machine
Time Machine
 
Async Scope With Mule ESB
Async Scope With Mule ESBAsync Scope With Mule ESB
Async Scope With Mule ESB
 
2.2 Reliable Message Bus based on RocketMQ
2.2 Reliable Message Bus based on RocketMQ2.2 Reliable Message Bus based on RocketMQ
2.2 Reliable Message Bus based on RocketMQ
 
ReactPHP + Symfony
ReactPHP + SymfonyReactPHP + Symfony
ReactPHP + Symfony
 
Mule soap
Mule soapMule soap
Mule soap
 
New Xcede - the ultimate reporting tool for Reckon APS suite
New Xcede - the ultimate reporting tool for Reckon APS suiteNew Xcede - the ultimate reporting tool for Reckon APS suite
New Xcede - the ultimate reporting tool for Reckon APS suite
 
Composite source in bound and out-bound
Composite source in bound and out-boundComposite source in bound and out-bound
Composite source in bound and out-bound
 
Version control 101
Version control 101Version control 101
Version control 101
 
Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019
 
Building and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemBuilding and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub System
 
Clustering and load balancing : jboss
Clustering and load balancing : jbossClustering and load balancing : jboss
Clustering and load balancing : jboss
 

Similar a Microsoft SQL Server Log Management

Redo and Rollback
Redo and RollbackRedo and Rollback
Redo and RollbackTubaahin10
 
Help! my sql server log file is too big!!! tech republic
Help! my sql server log file is too big!!!   tech republicHelp! my sql server log file is too big!!!   tech republic
Help! my sql server log file is too big!!! tech republicKaing Menglieng
 
Logging using ELK Stack for Microservices
Logging using ELK Stack for MicroservicesLogging using ELK Stack for Microservices
Logging using ELK Stack for MicroservicesVineet Sabharwal
 
arch_mtg_sqlsig_hcotter_replication.ppt
arch_mtg_sqlsig_hcotter_replication.pptarch_mtg_sqlsig_hcotter_replication.ppt
arch_mtg_sqlsig_hcotter_replication.pptssuser418eef
 
Real-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsReal-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsDevin Bost
 
Sql server 2016 it just runs faster sql bits 2017 edition
Sql server 2016 it just runs faster   sql bits 2017 editionSql server 2016 it just runs faster   sql bits 2017 edition
Sql server 2016 it just runs faster sql bits 2017 editionBob Ward
 
Large Scale SQL Considerations for SharePoint Deployments
Large Scale SQL Considerations for SharePoint DeploymentsLarge Scale SQL Considerations for SharePoint Deployments
Large Scale SQL Considerations for SharePoint DeploymentsJoel Oleson
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs FasterBob Ward
 
ETL with Clustered Columnstore - PASS Summit 2014
ETL with Clustered Columnstore - PASS Summit 2014ETL with Clustered Columnstore - PASS Summit 2014
ETL with Clustered Columnstore - PASS Summit 2014Niko Neugebauer
 
Troubleshooting Batch Reports
Troubleshooting Batch ReportsTroubleshooting Batch Reports
Troubleshooting Batch ReportsKai Liu
 
Webinar slides: Replication Topology Changes for MySQL and MariaDB
Webinar slides: Replication Topology Changes for MySQL and MariaDBWebinar slides: Replication Topology Changes for MySQL and MariaDB
Webinar slides: Replication Topology Changes for MySQL and MariaDBSeveralnines
 
Spark with Delta Lake
Spark with Delta LakeSpark with Delta Lake
Spark with Delta LakeKnoldus Inc.
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...
KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...
KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...Chris Fregly
 
Recovery, logging and the transaction log
Recovery, logging and the transaction logRecovery, logging and the transaction log
Recovery, logging and the transaction logMiroslav Dimitrov
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringarSqueed
 
Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008Frank
 

Similar a Microsoft SQL Server Log Management (20)

Redo and Rollback
Redo and RollbackRedo and Rollback
Redo and Rollback
 
Help! my sql server log file is too big!!! tech republic
Help! my sql server log file is too big!!!   tech republicHelp! my sql server log file is too big!!!   tech republic
Help! my sql server log file is too big!!! tech republic
 
Logging using ELK Stack for Microservices
Logging using ELK Stack for MicroservicesLogging using ELK Stack for Microservices
Logging using ELK Stack for Microservices
 
arch_mtg_sqlsig_hcotter_replication.ppt
arch_mtg_sqlsig_hcotter_replication.pptarch_mtg_sqlsig_hcotter_replication.ppt
arch_mtg_sqlsig_hcotter_replication.ppt
 
Real-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsReal-World Pulsar Architectural Patterns
Real-World Pulsar Architectural Patterns
 
Sql server 2016 it just runs faster sql bits 2017 edition
Sql server 2016 it just runs faster   sql bits 2017 editionSql server 2016 it just runs faster   sql bits 2017 edition
Sql server 2016 it just runs faster sql bits 2017 edition
 
Large Scale SQL Considerations for SharePoint Deployments
Large Scale SQL Considerations for SharePoint DeploymentsLarge Scale SQL Considerations for SharePoint Deployments
Large Scale SQL Considerations for SharePoint Deployments
 
Clontab webpage
Clontab webpageClontab webpage
Clontab webpage
 
Javaone 2014
Javaone 2014Javaone 2014
Javaone 2014
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs Faster
 
ETL with Clustered Columnstore - PASS Summit 2014
ETL with Clustered Columnstore - PASS Summit 2014ETL with Clustered Columnstore - PASS Summit 2014
ETL with Clustered Columnstore - PASS Summit 2014
 
Troubleshooting Batch Reports
Troubleshooting Batch ReportsTroubleshooting Batch Reports
Troubleshooting Batch Reports
 
Webinar slides: Replication Topology Changes for MySQL and MariaDB
Webinar slides: Replication Topology Changes for MySQL and MariaDBWebinar slides: Replication Topology Changes for MySQL and MariaDB
Webinar slides: Replication Topology Changes for MySQL and MariaDB
 
Spark with Delta Lake
Spark with Delta LakeSpark with Delta Lake
Spark with Delta Lake
 
Sql2008 (1)
Sql2008 (1)Sql2008 (1)
Sql2008 (1)
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...
KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...
KubeFlow + GPU + Keras/TensorFlow 2.0 + TF Extended (TFX) + Kubernetes + PyTo...
 
Recovery, logging and the transaction log
Recovery, logging and the transaction logRecovery, logging and the transaction log
Recovery, logging and the transaction log
 
Liquibase få kontroll på dina databasförändringar
Liquibase   få kontroll på dina databasförändringarLiquibase   få kontroll på dina databasförändringar
Liquibase få kontroll på dina databasförändringar
 
Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008Rac Optimisation For Siebel Crm, Doag 2008
Rac Optimisation For Siebel Crm, Doag 2008
 

Microsoft SQL Server Log Management

  • 1. Microsoft SQL Server: The Transaction Log and why you should care about VLF’s Level 400 Presented By: Stephan Lawson SQL DBA
  • 2.
  • 4.
  • 5. One or many, does it make a difference?
  • 6. Can the T-Log be optimized? Diving into the colourful world of Virtual Log Files.
  • 9.
  • 10. Start and end of each transaction.
  • 11. Every data modification(insert, update, delete) including system SP’s, DDL statements to any table including system tables.
  • 12. Every extent and page allocation and de-allocation.
  • 13. Creating or dropping tables and indexes.What is a transaction log?
  • 14. SQL Server uses a write-ahead log, this guarantees that no data modifications is written to the disk before the associated log record is written to disk. This maintains the ACID properties of a transaction. So this is how it works: How does it work?
  • 15. Unlike TempDB which benefits from having multiple data files, the T-Log does not; it only serves as redundancy. The T-Log is written to sequentially and in a round-robin fashion. Example; you create 3 T-logs for a database: One or many, does it matter? T1 T2 T3
  • 16. The T-Log is one of the things we overlook to optimize. Yes, put the log on separate SAN or SSD’s in a RAID 1+0 or 0+1 and give it a 100MB growth rate because that is better than 1MB. But why does 100MB perform better than 1MB? Do we ever look at how VLF’s affect our performance? Short answer; No. Can the T-Log be optimized?
  • 17. Deep Diving into VLF’s
  • 18.
  • 19. >= 64MB < 1GB = 8 VLF’s
  • 20. > 1GB = 16VLF’s
  • 21. Note that SQL 2005, 2008 and 2008 R2 has a bug where growing the T-Log in increments exactly 4Gb/8GB increments fail. It is best to grow the T-Log by 8000MB. This bug is fixed in SQL 11 which I’ll be using in the demo.VLF’s
  • 23. So how do we look at the VLF’s? We use the following command: DBCC LOGINFO(DB_NAME) This command is undocumented but is safe to run as it only reads the T-Log. Important columns to look for is the following: FileSize – VLF size in bytes Status – 0 Not in use, 2 In use CreateLSN – This can be used to determine how many VLF’s was created in a log file growth, 4, 8 or 16. This also indicates the Log Sequence Number. VLF Usage
  • 26. The log file is not Pandora’s Box. Monitoring, and optimizing the log file does have its benefits: Faster query execution. Faster indexing. Summary
  • 27. The following sites provide useful info on T-Logs and VLF’s: Both Paul and Kimberly has more in-depth articles on T-Log internals. http://www.sqlskills.com/blogs.asp T-Log architecture. http://msdn.microsoft.com/en-us/library/ms179355.aspx Resources

Notas del editor

  1. Modifications are made to a copy of the page in the buffer cache.Modifications are not written to disk until a checkpoint occurs, or the modification is made to disk when the buffer needs to hold a new page.Pages modified in the buffer cache, but not yet written to disk is called dirty pages.When a modification occurs on a page in the buffer cache, the associated log record is built in the log cache.The log must be written to disk before the dirty page is written to disk.If a dirty page is flushed before the log record is written, the modification made cannot be rolled back if the server fails before the log is written to disk.
  2. T1, T2 and T3.T1 will be written to and filled before moving to T2.When writes happen to T2, and T1 clears, then all new transactions will start again in T1.This is because a T-Log consist of multiple Virtual Log Files which gets filled (and created) sequentially. More on that later.