Performance Tuning of the Transaction Log

19
Performance Tuning of the Transaction Log A Peek in the most Critical and Misunderstood Part of SQL Server

description

SQL Saturday Bulgaria 2014

Transcript of Performance Tuning of the Transaction Log

Page 1: Performance Tuning of the Transaction Log

Performance Tuning of the Transaction Log

A Peek in the most Critical and Misunderstood Part of SQL Server

Page 2: Performance Tuning of the Transaction Log

Sponsors

Page 3: Performance Tuning of the Transaction Log

About me

Senior SQL Server DBA at HP Guest Lecturer at Sofia

University MCITP: SQL 2008 MCSE: Data Platform MCSA: Windows Server 2012 @miro_dd [email protected]

3 |

Page 4: Performance Tuning of the Transaction Log

Agenda

Introduction to Log

Transaction Log Structure

Top reasons for Log Performance Problems

Delayed Durability

Configuration Best Practices

Log Monitoring

4 |

Page 5: Performance Tuning of the Transaction Log

Introduction

What is it actually?

Write Ahead Logging

Log Cache

5 |

Page 6: Performance Tuning of the Transaction Log

Transaction Log Structure

6 |

Virtual Log Files

Log Blocks

Log Records

Page 7: Performance Tuning of the Transaction Log

Top Reasons for Log Performance problems

Unused Non-clustered Indexes

Log Autogrowth Setting

High Availability Features

7 |

sys.dm_db_index_usage_stats

Page 8: Performance Tuning of the Transaction Log

DEMO

Page 9: Performance Tuning of the Transaction Log

Top Reasons for Log Performance problems (2)

Fragmented Indexes

Many tiny transactions

9 |

https://www.flickr.com/photos/83633410@N07/7658225516

sys.dm_db_index_physical_stats

sys.dm_io_virtual_file_stats

sys.dm_io_pending_io_requests

Page 10: Performance Tuning of the Transaction Log

DEMO

Page 11: Performance Tuning of the Transaction Log

Delayed Durability

SQL 2014 Feature

Deferred Log Flushing

Tiny Transactions

Tolerate Data Loss!

11 |

Page 12: Performance Tuning of the Transaction Log

DEMO

Page 13: Performance Tuning of the Transaction Log

Configuration Best Practices

Initial Size

Number of VLFs

TEMPDB Log

Shrinking

Multiple Log Files

Reverting from Snapshot

Physical Location

13 |

https://www.flickr.com/photos/m-i-k-e/7231298090

Page 14: Performance Tuning of the Transaction Log

Log Monitoring

DMVs/DMFs

Performance Monitor Counters

Extended Events

14 |

Page 15: Performance Tuning of the Transaction Log

DEMO

Page 16: Performance Tuning of the Transaction Log

Key Takeaways

Transaction Log is crucial for the SQL performance

Many factors can have effect on it

Indexes – too many, fragmented

Configuration

16 |

Page 18: Performance Tuning of the Transaction Log

18 |

Thank You!

Page 19: Performance Tuning of the Transaction Log

Sponsors