Microsoft SQL Server 2012 Performance Tuning Cookbook

Microsoft SQL Server 2012 Performance Tuning Cookbook

Language: English

Pages: 478

ISBN: 1849685746

Format: PDF / Kindle (mobi) / ePub


80 recipes to help you tune SQL Server 2012 and achieve optimal performance

Overview

  • Learn about the performance tuning needs for SQL Server 2012 with this book and ebook
  • Diagnose problems when they arise and employ tricks to prevent them
  • Explore various aspects that affect performance by following the clear recipes

In Detail

As a DBA you must have encountered a slow running application on SQL Server, but there are various factors that could be affecting the performance. If you find yourself in this situation, don't wait, pick up this book and start working towards improving performance of your SQL Server 2012. SQL Server 2012 Performance Tuning Cookbook is divided into three major parts -- Performance Monitoring, Performance Tuning, and Performance Management--that are mandatory to deal with performance in any capacity.

SQL Server 2012 Performance Tuning Cookbook offers a great way to manage performance with effective, concise, and practical recipes. You will learn how to diagnose performance issues, fix them, and take precaution to avoid common mistakes.

Each recipe given in this book is an individual task that will address different performance aspects to take your SQL Server's Performance to a higher level.

The first part of this book covers Monitoring with SQL Server Profiler, DTA, System statistical function, SPs with DBCC commands, Resource Monitor & Reliability, and Performance Monitor and Execution Plan.

The second part of the book offers Execution Plan, Dynamic Management Views, and Dynamic Management Functions, SQL Server Cache and Stored Procedure Recompilations, Indexes, Important ways to write effective TSQL, Statistics, Table and Index Partitioning, Advanced Query tuning with Query Hints and Plan Guide, Dealing with Locking, Blocking and Deadlocking and Configuring SQL Server for optimization to boost performance.

The third and final part gives you knowledge of performance management with help of Policy Based Management and Management with Resource Governor.

What will you learn from this book

  • Monitoring SQL Server Performance with Profiler, Execution Plan, and system statistical function
  • Finding performance bottleneck with the help of Resource Monitor and DTA
  • Creating and Managing Indexes efficiently to boost performance
  • Creating and Managing Partition efficiently
  • Managing database files efficiently
  • Planning Guide and Query Hints
  • Dealing with locking, blocking, and deadlocking
  • Configuring SQL Server instance option for achieving performance benefit
  • Managing Performance with Policy based management and Resource Governor

Approach

This book has individual recipes and you can read it from cover to cover or dip into any recipe and get solution to a specific issue. Every recipe is based on a script/procedure explained with step-by-step instructions and screenshots. Concepts are illustrated for better understanding of why one solution performs better than another.

Who this book is written for

SQL Server 2012 Performance Tuning Cookbook is aimed at SQL Server Database Developers, DBAs, and Database Architects who are working in any capacity to achieve optimal performance. However, basic knowledge of SQL Server is expected, but professionals who want to get hands-on with performance tuning and have not worked on tuning the SQL Server for performance will find this book helpful.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

to find missing and unused indexes, to enhance performance by creating indexed views and creating an index on Computed Columns, and to determine disk space consumed by indexes. Chapter 11, Points to Consider While Writing Query, covers how to improve performance by limiting the number of columns and rows and by using sargable conditions, how to use arithmetic operators wisely in predicate to improve performance, how to improve query performance by not using functions on predicate columns, how to

significance. All other factors may have variance (fluctuation) depends on the situation such as in pick hour, factors are in heavy pressure so might show you a higher number of CPU or memory utilization; and in off hours, you will find idle resources. While dealing with bad performance, it is highly important that we first see non-fluctuating cost reference so we can decide query performance increment or decrement, after we have taken the steps to improve query performance and re-executed the

clustered index on the table SalesOrdHeaderDemo with the following query:CREATE UNIQUE CLUSTERED INDEX idx_salesorderheaderdemo_SalesOrderID ON SalesOrdHeaderDemo (SalesOrderID) GO Now execute the following SELECT query to see whether the table scan is removed or not:SELECT sh.SalesOrderID FROM SalesOrdHeaderDemo AS sh JOIN SalesOrdDetailDemo AS sd ON sh.SalesOrderID=sd.SalesOrderID WHERE sh.OrderDate='2005-07-01 00:00:00.000' GO The following is the screenshot of the Execution plan

resolving them Key Lookup is a bookmark lookup on a table with a clustered index. Key Lookup is used by SQL Server while retrieving information regarding non-key column. All the queries that use non-clustered index wouldn't have Key Lookup but all Key Lookup occurrences are accompanied by a non-clustered index. One more thing to remember is that Key Lookup always enjoys the company of Nested Loop operator. Getting ready We are going to create a table to see different effects of Key

and execute the same SELECT statement given previously with the execution plan, to see the difference in the query when run before and after the clustered index is created. The main reasons for choosing the Refno field as the key column of the clustered index are:It is a numeric value (not a varchar), so the clustered index will be short Refno will be frequently used in searches and maybe in a JOIN clause. In the current scenario (table), it seems better than the other two (Orderdate and

Download sample

Download