Download presentation
Presentation is loading. Please wait.
1
Dave Bland @SQLDave29 LinkedIn Daveb8782@gmail.com
2
13 years DBA Experience Teaching SQL Server since 1999 SQL Server Instructor at Harper College, Palatine, IL Currently supervise a team of DBAs DBA consultant for Einstein Technology Solutions, Lombard, IL
3
Certifications
4
How does SQL Server execute a query Types of Execution Plans Common query bottlenecks Plan Cache First Look at an Execution Plan Execution Plan Icons and Identifying potential performance bottlenecks SQL Sentry Plan Explorer
5
“ An execution plan, simply put, is the result of the query optimizer's attempt to calculate the most efficient way to implement the request represented by the T-SQL” Grant Fritchey - SQL Server Execution Plans Second Edition
7
Minimum permissions needed: ShowPlan in the database Members of Sysadmin role Members of DB_Owner
8
Disk I\O CPU Memory Network Poor query design Missing indexes Indexes not optimized Statistics out of date
9
Types of Plans ◦ Actual ◦ Estimated Displaying Execution Plans ◦ Graphical plans ◦ Text plans (deprecated) ◦ XML plans Saving ◦.SQLPLAN
10
Algebrizer process creates a hash of incoming query(DML Only) What flushes a plan from Cache ◦ Not enough memory ◦ DBCC FREEPROCCACHE ◦ Schema Changes to referenced objects ◦ Statistics used by the plan are updated ◦ Changes made to the stored procedure
12
Used for comparative purposes Float cursor over icon
13
Index Scan vs Index Seek Scan searches data pages Seek is preferred for highly selective queries If scan, check for index or a useful index
14
Usually considered less than optimal If table is very small may not be an issue If expecting an Index Scan or Seek: Update statistics Rebuild indexes Review query
16
Can be difficult to test on a development machine Some statements can force a serial plan
17
Use of cursor with sys.sp_Msforeachdb Data type conversions Foreign Key full table scan due to lack of index
18
Happens when joining on different data types Can lead to excessive CPU utilization Can occur in the FROM or the WHERE clause
19
In this case, this is the Estimated Execution plan, actual was more accurate
20
Only retrieve what you need Minimize use of temporary tables Avoid cursors Work with your DBA to arrange good indexes to support filters, joins and ordering Learn how to address tasks with different query approaches to compare performance
21
Must have a baseline for normal performance Establish at different times of day Document the baseline
23
Table redesign Redesign query More memory Add Indexes Optimize indexes Update statistics Reboot
24
Microsoft SQL Server 2014 Query Tuning and Optimization – Benjamin Nevarez www.sql-server-performance.com www.sql-server-performance.com https://msdn.microsoft.com https://msdn.microsoft.com http://sqlblog.com/blogs/paul_white http://sqlblog.com/blogs/paul_white http://www.scarydba.com http://www.scarydba.com Paul White Blog Paul White Blog
25
Understanding Parallelism Understanding Parallelism BrentOzar.com BrentOzar.com SQL Server Execution Plans – Grant Fritchey https://msdn.microsoft.com https://msdn.microsoft.com
26
SQLQuestions@stericycle.com DBA Blog
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.