Tuning and Optimising Queries using Microsoft SQL Server 2005 (Course Code: 2784)

Course Schedule:

Location Days Course dates Duration Cost (ex GST) Availability Enrol Here
City Mon - Wed 13 - 15 Oct 2008 3 days 1620.00 Open Corporate Group / Individual
Microsoft Certified Partner

Overview:

This three-day instructor-led course will provide database developers working in enterprise environments using Microsoft SQL Server 2005 the knowledge and skills to evaluate and improve queries and query response times. It focuses on systematic identification and optimisation of database factors that impact query performance.

Who will benefit from this course?

This course is intended for current professional database developers who have three or more years of on-the-job experience developing SQL Server database solutions in an enterprise environment.

Pre-requisites

Before attending this course, you must:

  • have working knowledge of data storage. Specifically, knowledge about row layout, fixed length field placement and varying length field placement
  • be familiar with index structures and index utilisation. Specifically, they must understand the interaction between non-clustered indexes, clustered indexes and heaps. They must know why a covering index can improve performance
  • have had hands-on database developer experience. Specifically, three years of experience as a full-time database developer in an enterprise environment
  • be familiar with the locking model. Specifically, students should have an understanding of lock modes, lock objects and isolation levels and be familiar with process blocking
  • understand Transact-SQL syntax and programming logic. Specifically, students should be completely fluent in advanced queries, aggregate queries, sub queries, user-defined functions, cursors, control of flow statements CASE expressions, and all types of joins
  • be able to design a database to third normal form (3NF) and know the trade offs when backing out of the fully normalised design (denormalisation) and designing for performance and business requirements in addition to being familiar with design models, such as Star and Snowflake schemas
  • have strong monitoring and troubleshooting skills, including using monitoring tools
  • have basic knowledge of the operating system and platform. That is, how the operating system integrates with the database, what the platform or operating system can do, and how interaction between the operating system and the database works
  • have basic knowledge of application architecture. That is, how applications can be designed in three layers, what applications can do, how interaction between the application and the database works, and how the interaction between the database and the platform or operating system works
  • know how to use a data modelling tool
  • be familiar with SQL Server 2005 features, tools, and technologies
  • have a Microsoft Certified Technology Specialist: Microsoft SQL Server 2005 credential - or equivalent experience

In addition, it is recommended, but not required, that students have completed:

  • Course 2071: Writing Queries Using Microsoft Transact-SQL
  • Course 2779: Implementing a Microsoft SQL Server 2005 Database
  • Course 2780: Maintaining a Microsoft SQL Server 2005 Database

What can you expect to gain from this course?

After completing this course, you will be able to:

  • normalise databases
  • design a normalised database.
  • optimise a database design by denormalising.
  • optimise data storage
  • manage concurrency
  • manage concurrency by selecting the appropriate transaction isolation level.
  • select a locking granularity level.
  • optimise and tune queries for performance
  • optimise an indexing strategy
  • decide when cursors are appropriate
  • identify and resolve performance-limiting problems

Course Content:

Module 1:Measuring Database Performance
  • This unit provides students with an opportunity to measure database performance and identify database performance bottlenecks. Students will use a sample script to identify performance and concurrency problems, capture baseline performance, and prioritise identified problems for optimisation.
  • Importance of Benchmarking
  • Key Measures for Query Performance: Sysmon
  • Key Measures for Query Performance: Profiler
  • Guidelines for Identifying Locking and Blocking
  • Exercise: Measuring Database Performance
  • Reviewing Tables and Scripts
  • Determining Performance Baselines
  • Prioritising Identified Problems
Module 2:Optimising Physical Database Design
  • In this unit, students work with strategies for optimising physical database design. Students will optimise a database schema using normalisation, generalisation, and denormalisation.
  • Performance Optimisation Model
  • Schema Optimisation Strategy: Keys
  • Schema Optimisation Strategy: Responsible Denormalisation
  • Schema Optimisation Strategy: Generalisation
  • Exercise: Optimising Schemas
  • Optimising Memberships
  • Optimising Events
  • Normalising Event Sponsorships
  • Denormalising Membership Visits
  • Cleaning Up Schema
  • Adapting the Solution to the New Database Schema
  • Determining Performance
Module 3:Optimising Queries for Performance
  • In this unit students experience optimising and tuning queries to improve performance. In the lab, students will optimise stored procedures, views, and non-cursor aggregate queries to improve database performance and user experience. Each query that is optimised improves the overall system because the query will use fewer resources, freeing up those resources for other queries, and reducing the amount of locking done by the query. The domino effect is profound.
  • Performance Optimisation Model: Queries
  • What Is Query Logical Flow?
  • Considerations for Using Sub queries
  • Guidelines for Building Efficient Queries
  • Exercise: Optimising Queries
  • Optimising and Rewriting Slow Performing Stored Procedures
  • Optimising and Rewriting Slow Performing Views
  • Optimising and Rewriting Slow Performing Non-Cursor Aggregate Queries
  • Determining Performance
Module 4:Refactoring Cursors into Queries
  • In this unit, students will work with strategies for refactoring cursors into queries. In the lab, students will work to optimise a database by replacing slow iterative code with faster set-based code.
  • Performance Optimisation Model: Query-Set-based solutions
  • Five Steps to Building a Cursor
  • Strategies for Refactoring Cursors
  • Exercise: Refactoring Cursors into Queries
  • Refactoring the pMembershipCategory Cursor
  • Refactoring the pCommunityImpact Cursor
  • Refactoring the pMemberInvitation Cursor
  • Determining Performance
Module 5:Optimising an Indexing Strategy
  • In this unit, students will work on optimising indexing strategies. Students will work with a given database to add and delete indexes, by providing the optimum bridge between the query and the data without any redundancies.
  • Performance Optimisation Model: Indexes
  • Considerations for Using Indexes
  • Best Uses of the Clustered Index
  • Best Practices for Non-Clustered Index Design
  • How to Document an Indexing Strategy
  • Exercise: Optimising an Indexing Strategy
  • Identifying Tables to Optimise
  • Designing Indexes
  • Determining Performance
Module 6:Managing Concurrency
  • This unit provides students with the opportunity to work with concurrency management. Students will look for concurrency issues and then solve them by optimising transactions and adjusting the transaction isolation level.
  • Performance Optimisation Model: Locking and Blocking
  • Multimedia - "How to Use Efficient Queries to Reduce Locking and Blocking"
  • Strategies to Reduce Locking and Blocking
  • Exercise: Reducing Blocking
  • Identifying Code with Locking and Blocking Issues
  • Reducing Concurrency Issues
  • Determining Final Performance