SlideShare a Scribd company logo
Grant Fritchey | www.ScaryDBA.com
www.ScaryDBA.com
SQL Server Optimization
Checklist
Grant Fritchey
Product Evangelist
Red Gate Software
Grant Fritchey | www.ScaryDBA.com
Agenda
 Server Configuration
 SQL Server Administration
 Database Design
 TSQL Coding
2
Grant Fritchey | www.ScaryDBA.com
Get it Touch
3
scarydba.com
grant@scarydba.com
@gfritchey
Grant Fritchey | www.ScaryDBA.com
Test
Test
Test
Test
Test
4
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
5
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
6
There are always exceptions
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
7
Your hardware may be DIFFERENT
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
 Your hardware may be different
8
Did I mention test?
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
 Your hardware may be different
 Did I mention test?
9
In
cre
men
tal changes
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
 Your hardware may be different
 Did I mention test?
 Incremental changes
10
onitoryour servers
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
 Your hardware may be different
 Did I mention test?
 Incremental changes
 Monitor your servers
11
I am NOT a systems expert
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
 Your hardware may be different
 Did I mention test?
 Incremental changes
 Monitor your servers
 I am not a systems expert
12
You might want toTEST
Grant Fritchey | www.ScaryDBA.com
Remember
 This is focused on performance tuning
 There are always exceptions
 Your hardware may be different
 Did I mention test?
 Incremental changes
 Monitor your servers
 I am not a systems expert
 You might want to test
13
Grant Fritchey | www.ScaryDBA.com
Server Configuration
14
Memory CPU Disks
Grant Fritchey | www.ScaryDBA.com
SQL Server Configuration:
Memory
 >4g enable AWE
» On 2008R2 or less
» On 32-bit systems
 Dynamic
» but set a minimum and a maximum value
 Optimize for Ad HocWorkloads
» Enable on all servers
15
Grant Fritchey | www.ScaryDBA.com
SQL Server Configuration:
CPU
 CostThreshold for parallelism
» 5, the default, is too low
» OLTP = 40
» Reporting = 25
 Max Degree of Parallelism
» Leave it on, after you change the cost threshold
 Consider using Query Governor
» Set a cost limit
16
Grant Fritchey | www.ScaryDBA.com
SQL Server Configuration:
Storage
 TEMPDB
» Separate from other data when possible
» Multiple Files
— Not equal to #of processors
— Equal sized files
 Compression
» Minimum, index compression
 More disks is better
» But only if you have more controllers
 Spend money
» Buy faster disks
17
Grant Fritchey | www.ScaryDBA.com
SQL Server
Administration
 Maintain Statistics
» Enable AUTO_CREATE & AUTO_UPDATE
» You must also plan for manual updates
» You may need FULL SCAN
» Consider ASYNC
 Defragment your indexes
» Number of pages does matter
» You can defrag below 1000 pages
» You can’t defrag below 8 pages
» Separate defrag & statistics updates
18
Grant Fritchey | www.ScaryDBA.com
SQL Server
Administration 2
 Avoid dangerous settings
» Disable AUTO_CLOSE
» Disable AUTO_SHRINK
 Do not use the Profiler GUI on production systems
» Create a server-side trace usingTSQL scripts
(prior to 2008)
» Use extended events
— Consider for 2008 or better
— Absolutely for 2012 or better
 Set Blocked ProcessThreshold
» Based on your system
19
Grant Fritchey | www.ScaryDBA.com
Database Design
 Storage
 Constraints
 Indexes
20
Grant Fritchey | www.ScaryDBA.com
Database Design: Storage
 Separate Log & Data
 Multiple File Groups
» Even on a single drive
 Turn off auto-grow
» If not possible, used fixed growth, not percentage
 Consider In-Memory
» 2014 only
» I/O Latch waits
21
Grant Fritchey | www.ScaryDBA.com
Database Design:
Constraints
 Normalize your Data
» Normalization benefits performance
 Enforce Constraints
» Foreign keys
» Primary keys
» Unique values
22
Grant Fritchey | www.ScaryDBA.com
Database Design: Indexes -
General
 Narrow
» As narrow as possible
 Integers
» Believe it or not, they’re better
 Choose leading edge carefully
» Most selective column
 Covering Indexes are fastest
» Use INCLUDE
23
Grant Fritchey | www.ScaryDBA.com
Database Design: Indexes -
Clustered
 Again, Narrow
» As narrow as possible
 Design around the clustered index
» Most frequent used path to data
 Rebuilding clustered index
» Use DROP_EXISTING
 Avoid columns that get updated frequently
» This means all non-clustered indexes are updated
too
24
Grant Fritchey | www.ScaryDBA.com
TSQL Coding
 Return only the data you need, when you need it
 Use stored procedures or parameterized queries
» Encourages plan reuse
» Prevents SQL Injection
 Avoid cursors,WHILE, LOOP
» Row By Agonizing Row style processing
 Qualify all object names
» Reduces lookup costs
 Avoid using ‘sp_*’ for procedure names
» Eliminates additional read to the master database
25
Grant Fritchey | www.ScaryDBA.com
TSQL Coding 2
 Avoid nonsargeable conditions
» Meaning functions on columns
» Or, using LIKE ‘%Anything’
 Use SET NOCOUNT ON
» Reduces returns on network
 Do not nest views
» Or join them. It confuses the optimizer
 Don’t use optimizer hints
» More often than not it causes problems
» Especially NOLOCK
26
Grant Fritchey | www.ScaryDBA.com
TSQL Coding 3
 Avoid Recompiling Execution Plans
» Stored procedures & parameterized queries
» Table variables instead of temp tables
» ANSI standards on connection settings
— And Don’t change them within a query
» Don’t interleave DDL & DML
 Adopt best practices for transactions
» Keep scope as short as possible
» Use SET XACT_ABORT
» Consider using READ COMMITTED SNAPSHOT
27
Grant Fritchey | www.ScaryDBA.com
Relax
 It’s not that bad
 Most things can be changed
 Help is available
 Test everything
28
Grant Fritchey | www.ScaryDBA.com
Questions?
29
Ad

More Related Content

What's hot (20)

Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL Server
Rajesh Gunasundaram
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
Antonios Chatzipavlis
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance Tuning
Bala Subra
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query Performance
Vinod Kumar
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
SQL Server Performance Tuning Baseline
SQL Server Performance Tuning BaselineSQL Server Performance Tuning Baseline
SQL Server Performance Tuning Baseline
► Supreme Mandal ◄
 
Inside SQL Server In-Memory OLTP
Inside SQL Server In-Memory OLTPInside SQL Server In-Memory OLTP
Inside SQL Server In-Memory OLTP
Bob Ward
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 
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
Bob Ward
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
Dean Richards
 
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should KnowSQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
Bob Ward
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL Database
Tung Nguyen Thanh
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
Enkitec
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
Experience sql server on l inux and docker
Experience sql server on l inux and dockerExperience sql server on l inux and docker
Experience sql server on l inux and docker
Bob Ward
 
SQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowSQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should Know
Bob Ward
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs Faster
Bob Ward
 
Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning
Kernel Training
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
nitin anjankar
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL Server
Rajesh Gunasundaram
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance Tuning
Bala Subra
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query Performance
Vinod Kumar
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
SQL Server Performance Tuning Baseline
SQL Server Performance Tuning BaselineSQL Server Performance Tuning Baseline
SQL Server Performance Tuning Baseline
► Supreme Mandal ◄
 
Inside SQL Server In-Memory OLTP
Inside SQL Server In-Memory OLTPInside SQL Server In-Memory OLTP
Inside SQL Server In-Memory OLTP
Bob Ward
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsfOracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 
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
Bob Ward
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
Dean Richards
 
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should KnowSQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
Bob Ward
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL Database
Tung Nguyen Thanh
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
Enkitec
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017Enhancements that will make your sql database roar sp1 edition sql bits 2017
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
Experience sql server on l inux and docker
Experience sql server on l inux and dockerExperience sql server on l inux and docker
Experience sql server on l inux and docker
Bob Ward
 
SQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowSQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should Know
Bob Ward
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs Faster
Bob Ward
 
Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning
Kernel Training
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
nitin anjankar
 

Similar to SQL Server Optimization Checklist (20)

Changing Your Habits: Tips to Tune Your T-SQL
Changing Your Habits: Tips to Tune Your T-SQLChanging Your Habits: Tips to Tune Your T-SQL
Changing Your Habits: Tips to Tune Your T-SQL
Grant Fritchey
 
Introducing Azure SQL Data Warehouse
Introducing Azure SQL Data WarehouseIntroducing Azure SQL Data Warehouse
Introducing Azure SQL Data Warehouse
Grant Fritchey
 
Top Tips for Better T-SQL
Top Tips for Better T-SQLTop Tips for Better T-SQL
Top Tips for Better T-SQL
Grant Fritchey
 
Why new hardware may not make SQL Server faster
Why new hardware may not make SQL Server fasterWhy new hardware may not make SQL Server faster
Why new hardware may not make SQL Server faster
SolarWinds
 
Query Tuning Azure SQL Databases
Query Tuning Azure SQL DatabasesQuery Tuning Azure SQL Databases
Query Tuning Azure SQL Databases
Grant Fritchey
 
Grant Fritchey - Query Tuning In Azure SQL Database
Grant Fritchey - Query Tuning In Azure SQL DatabaseGrant Fritchey - Query Tuning In Azure SQL Database
Grant Fritchey - Query Tuning In Azure SQL Database
Red Gate Software
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuning
OutsourceAX
 
Azure SQL Database for the Earthed DBA
Azure SQL Database for the Earthed DBAAzure SQL Database for the Earthed DBA
Azure SQL Database for the Earthed DBA
Grant Fritchey
 
Analysis Services Best Practices From Large Deployments
Analysis Services   Best Practices From Large DeploymentsAnalysis Services   Best Practices From Large Deployments
Analysis Services Best Practices From Large Deployments
rsnarayanan
 
Pro Techniques for the SSASMD Developer
Pro Techniques for the SSASMD DeveloperPro Techniques for the SSASMD Developer
Pro Techniques for the SSASMD Developer
Jens Vestergaard
 
Common SQL Server Mistakes and How to Avoid Them with Tim Radney
Common SQL Server Mistakes and How to Avoid Them with Tim RadneyCommon SQL Server Mistakes and How to Avoid Them with Tim Radney
Common SQL Server Mistakes and How to Avoid Them with Tim Radney
Embarcadero Technologies
 
GOTO 2013: Why Zalando trusts in PostgreSQL
GOTO 2013: Why Zalando trusts in PostgreSQLGOTO 2013: Why Zalando trusts in PostgreSQL
GOTO 2013: Why Zalando trusts in PostgreSQL
Henning Jacobs
 
Strata + Hadoop 2015 Slides
Strata + Hadoop 2015 SlidesStrata + Hadoop 2015 Slides
Strata + Hadoop 2015 Slides
Jun Liu
 
Geek Sync | Top 10 SQL Server Performance Makers and Breakers
Geek Sync | Top 10 SQL Server Performance Makers and BreakersGeek Sync | Top 10 SQL Server Performance Makers and Breakers
Geek Sync | Top 10 SQL Server Performance Makers and Breakers
IDERA Software
 
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
Antonios Chatzipavlis
 
PGDay India 2016
PGDay India 2016PGDay India 2016
PGDay India 2016
Himanchali -
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
Lari Hotari
 
Cloudforms Workshop
Cloudforms WorkshopCloudforms Workshop
Cloudforms Workshop
Scalar Decisions
 
Database continuous integration, unit test and functional test
Database continuous integration, unit test and functional testDatabase continuous integration, unit test and functional test
Database continuous integration, unit test and functional test
Harry Zheng
 
Optimizing Python
Optimizing PythonOptimizing Python
Optimizing Python
AdimianBE
 
Changing Your Habits: Tips to Tune Your T-SQL
Changing Your Habits: Tips to Tune Your T-SQLChanging Your Habits: Tips to Tune Your T-SQL
Changing Your Habits: Tips to Tune Your T-SQL
Grant Fritchey
 
Introducing Azure SQL Data Warehouse
Introducing Azure SQL Data WarehouseIntroducing Azure SQL Data Warehouse
Introducing Azure SQL Data Warehouse
Grant Fritchey
 
Top Tips for Better T-SQL
Top Tips for Better T-SQLTop Tips for Better T-SQL
Top Tips for Better T-SQL
Grant Fritchey
 
Why new hardware may not make SQL Server faster
Why new hardware may not make SQL Server fasterWhy new hardware may not make SQL Server faster
Why new hardware may not make SQL Server faster
SolarWinds
 
Query Tuning Azure SQL Databases
Query Tuning Azure SQL DatabasesQuery Tuning Azure SQL Databases
Query Tuning Azure SQL Databases
Grant Fritchey
 
Grant Fritchey - Query Tuning In Azure SQL Database
Grant Fritchey - Query Tuning In Azure SQL DatabaseGrant Fritchey - Query Tuning In Azure SQL Database
Grant Fritchey - Query Tuning In Azure SQL Database
Red Gate Software
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuning
OutsourceAX
 
Azure SQL Database for the Earthed DBA
Azure SQL Database for the Earthed DBAAzure SQL Database for the Earthed DBA
Azure SQL Database for the Earthed DBA
Grant Fritchey
 
Analysis Services Best Practices From Large Deployments
Analysis Services   Best Practices From Large DeploymentsAnalysis Services   Best Practices From Large Deployments
Analysis Services Best Practices From Large Deployments
rsnarayanan
 
Pro Techniques for the SSASMD Developer
Pro Techniques for the SSASMD DeveloperPro Techniques for the SSASMD Developer
Pro Techniques for the SSASMD Developer
Jens Vestergaard
 
Common SQL Server Mistakes and How to Avoid Them with Tim Radney
Common SQL Server Mistakes and How to Avoid Them with Tim RadneyCommon SQL Server Mistakes and How to Avoid Them with Tim Radney
Common SQL Server Mistakes and How to Avoid Them with Tim Radney
Embarcadero Technologies
 
GOTO 2013: Why Zalando trusts in PostgreSQL
GOTO 2013: Why Zalando trusts in PostgreSQLGOTO 2013: Why Zalando trusts in PostgreSQL
GOTO 2013: Why Zalando trusts in PostgreSQL
Henning Jacobs
 
Strata + Hadoop 2015 Slides
Strata + Hadoop 2015 SlidesStrata + Hadoop 2015 Slides
Strata + Hadoop 2015 Slides
Jun Liu
 
Geek Sync | Top 10 SQL Server Performance Makers and Breakers
Geek Sync | Top 10 SQL Server Performance Makers and BreakersGeek Sync | Top 10 SQL Server Performance Makers and Breakers
Geek Sync | Top 10 SQL Server Performance Makers and Breakers
IDERA Software
 
Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014Configuring sql server - SQL Saturday, Athens Oct 2014
Configuring sql server - SQL Saturday, Athens Oct 2014
Antonios Chatzipavlis
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
Lari Hotari
 
Database continuous integration, unit test and functional test
Database continuous integration, unit test and functional testDatabase continuous integration, unit test and functional test
Database continuous integration, unit test and functional test
Harry Zheng
 
Optimizing Python
Optimizing PythonOptimizing Python
Optimizing Python
AdimianBE
 
Ad

More from Grant Fritchey (20)

You Need a PostgreSQL Restore Plan Presentation
You Need a PostgreSQL Restore Plan PresentationYou Need a PostgreSQL Restore Plan Presentation
You Need a PostgreSQL Restore Plan Presentation
Grant Fritchey
 
PostgreSQL Query Performance Monitoring for the Absolute Beginner
PostgreSQL Query Performance Monitoring for the Absolute BeginnerPostgreSQL Query Performance Monitoring for the Absolute Beginner
PostgreSQL Query Performance Monitoring for the Absolute Beginner
Grant Fritchey
 
Leveraging AI for the PostgreSQL DBA #pgconf.eu
Leveraging AI for the PostgreSQL DBA #pgconf.euLeveraging AI for the PostgreSQL DBA #pgconf.eu
Leveraging AI for the PostgreSQL DBA #pgconf.eu
Grant Fritchey
 
Exploring Execution Plans, Learning to Read SQL Server Execution Plans
Exploring Execution Plans, Learning to Read SQL Server Execution PlansExploring Execution Plans, Learning to Read SQL Server Execution Plans
Exploring Execution Plans, Learning to Read SQL Server Execution Plans
Grant Fritchey
 
SQL Server Performance Tuning: Common Problems, Possible Solutions
SQL Server Performance Tuning: Common Problems, Possible SolutionsSQL Server Performance Tuning: Common Problems, Possible Solutions
SQL Server Performance Tuning: Common Problems, Possible Solutions
Grant Fritchey
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQL
Grant Fritchey
 
PostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingPostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and Alerting
Grant Fritchey
 
Automating Database Deployments Using Azure DevOps
Automating Database Deployments Using Azure DevOpsAutomating Database Deployments Using Azure DevOps
Automating Database Deployments Using Azure DevOps
Grant Fritchey
 
Learn To Effectively Use Extended Events_Techorama.pdf
Learn To Effectively Use Extended Events_Techorama.pdfLearn To Effectively Use Extended Events_Techorama.pdf
Learn To Effectively Use Extended Events_Techorama.pdf
Grant Fritchey
 
Using Query Store to Understand and Control Query Performance
Using Query Store to Understand and Control Query PerformanceUsing Query Store to Understand and Control Query Performance
Using Query Store to Understand and Control Query Performance
Grant Fritchey
 
You Should Be Standing Here: Learn How To Present a Session
You Should Be Standing Here: Learn How To Present a SessionYou Should Be Standing Here: Learn How To Present a Session
You Should Be Standing Here: Learn How To Present a Session
Grant Fritchey
 
Redgate Community Circle: Tools For SQL Server Performance Tuning
Redgate Community Circle: Tools For SQL Server Performance TuningRedgate Community Circle: Tools For SQL Server Performance Tuning
Redgate Community Circle: Tools For SQL Server Performance Tuning
Grant Fritchey
 
10 Steps To Global Data Compliance
10 Steps To Global Data Compliance10 Steps To Global Data Compliance
10 Steps To Global Data Compliance
Grant Fritchey
 
Time to Use the Columnstore Index
Time to Use the Columnstore IndexTime to Use the Columnstore Index
Time to Use the Columnstore Index
Grant Fritchey
 
Introduction to SQL Server in Containers
Introduction to SQL Server in ContainersIntroduction to SQL Server in Containers
Introduction to SQL Server in Containers
Grant Fritchey
 
DevOps for the DBA
DevOps for the DBADevOps for the DBA
DevOps for the DBA
Grant Fritchey
 
SQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop ItSQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop It
Grant Fritchey
 
Privacy and Protection in the World of Database DevOps
Privacy and Protection in the World of Database DevOpsPrivacy and Protection in the World of Database DevOps
Privacy and Protection in the World of Database DevOps
Grant Fritchey
 
SQL Server Tools for Query Tuning
SQL Server Tools for Query TuningSQL Server Tools for Query Tuning
SQL Server Tools for Query Tuning
Grant Fritchey
 
You Need a PostgreSQL Restore Plan Presentation
You Need a PostgreSQL Restore Plan PresentationYou Need a PostgreSQL Restore Plan Presentation
You Need a PostgreSQL Restore Plan Presentation
Grant Fritchey
 
PostgreSQL Query Performance Monitoring for the Absolute Beginner
PostgreSQL Query Performance Monitoring for the Absolute BeginnerPostgreSQL Query Performance Monitoring for the Absolute Beginner
PostgreSQL Query Performance Monitoring for the Absolute Beginner
Grant Fritchey
 
Leveraging AI for the PostgreSQL DBA #pgconf.eu
Leveraging AI for the PostgreSQL DBA #pgconf.euLeveraging AI for the PostgreSQL DBA #pgconf.eu
Leveraging AI for the PostgreSQL DBA #pgconf.eu
Grant Fritchey
 
Exploring Execution Plans, Learning to Read SQL Server Execution Plans
Exploring Execution Plans, Learning to Read SQL Server Execution PlansExploring Execution Plans, Learning to Read SQL Server Execution Plans
Exploring Execution Plans, Learning to Read SQL Server Execution Plans
Grant Fritchey
 
SQL Server Performance Tuning: Common Problems, Possible Solutions
SQL Server Performance Tuning: Common Problems, Possible SolutionsSQL Server Performance Tuning: Common Problems, Possible Solutions
SQL Server Performance Tuning: Common Problems, Possible Solutions
Grant Fritchey
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQL
Grant Fritchey
 
PostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingPostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and Alerting
Grant Fritchey
 
Automating Database Deployments Using Azure DevOps
Automating Database Deployments Using Azure DevOpsAutomating Database Deployments Using Azure DevOps
Automating Database Deployments Using Azure DevOps
Grant Fritchey
 
Learn To Effectively Use Extended Events_Techorama.pdf
Learn To Effectively Use Extended Events_Techorama.pdfLearn To Effectively Use Extended Events_Techorama.pdf
Learn To Effectively Use Extended Events_Techorama.pdf
Grant Fritchey
 
Using Query Store to Understand and Control Query Performance
Using Query Store to Understand and Control Query PerformanceUsing Query Store to Understand and Control Query Performance
Using Query Store to Understand and Control Query Performance
Grant Fritchey
 
You Should Be Standing Here: Learn How To Present a Session
You Should Be Standing Here: Learn How To Present a SessionYou Should Be Standing Here: Learn How To Present a Session
You Should Be Standing Here: Learn How To Present a Session
Grant Fritchey
 
Redgate Community Circle: Tools For SQL Server Performance Tuning
Redgate Community Circle: Tools For SQL Server Performance TuningRedgate Community Circle: Tools For SQL Server Performance Tuning
Redgate Community Circle: Tools For SQL Server Performance Tuning
Grant Fritchey
 
10 Steps To Global Data Compliance
10 Steps To Global Data Compliance10 Steps To Global Data Compliance
10 Steps To Global Data Compliance
Grant Fritchey
 
Time to Use the Columnstore Index
Time to Use the Columnstore IndexTime to Use the Columnstore Index
Time to Use the Columnstore Index
Grant Fritchey
 
Introduction to SQL Server in Containers
Introduction to SQL Server in ContainersIntroduction to SQL Server in Containers
Introduction to SQL Server in Containers
Grant Fritchey
 
SQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop ItSQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop It
Grant Fritchey
 
Privacy and Protection in the World of Database DevOps
Privacy and Protection in the World of Database DevOpsPrivacy and Protection in the World of Database DevOps
Privacy and Protection in the World of Database DevOps
Grant Fritchey
 
SQL Server Tools for Query Tuning
SQL Server Tools for Query TuningSQL Server Tools for Query Tuning
SQL Server Tools for Query Tuning
Grant Fritchey
 
Ad

Recently uploaded (20)

Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 

SQL Server Optimization Checklist

  • 1. Grant Fritchey | www.ScaryDBA.com www.ScaryDBA.com SQL Server Optimization Checklist Grant Fritchey Product Evangelist Red Gate Software
  • 2. Grant Fritchey | www.ScaryDBA.com Agenda  Server Configuration  SQL Server Administration  Database Design  TSQL Coding 2
  • 3. Grant Fritchey | www.ScaryDBA.com Get it Touch 3 scarydba.com [email protected] @gfritchey
  • 4. Grant Fritchey | www.ScaryDBA.com Test Test Test Test Test 4
  • 5. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning 5
  • 6. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning 6 There are always exceptions
  • 7. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions 7 Your hardware may be DIFFERENT
  • 8. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions  Your hardware may be different 8 Did I mention test?
  • 9. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions  Your hardware may be different  Did I mention test? 9 In cre men tal changes
  • 10. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions  Your hardware may be different  Did I mention test?  Incremental changes 10 onitoryour servers
  • 11. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions  Your hardware may be different  Did I mention test?  Incremental changes  Monitor your servers 11 I am NOT a systems expert
  • 12. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions  Your hardware may be different  Did I mention test?  Incremental changes  Monitor your servers  I am not a systems expert 12 You might want toTEST
  • 13. Grant Fritchey | www.ScaryDBA.com Remember  This is focused on performance tuning  There are always exceptions  Your hardware may be different  Did I mention test?  Incremental changes  Monitor your servers  I am not a systems expert  You might want to test 13
  • 14. Grant Fritchey | www.ScaryDBA.com Server Configuration 14 Memory CPU Disks
  • 15. Grant Fritchey | www.ScaryDBA.com SQL Server Configuration: Memory  >4g enable AWE » On 2008R2 or less » On 32-bit systems  Dynamic » but set a minimum and a maximum value  Optimize for Ad HocWorkloads » Enable on all servers 15
  • 16. Grant Fritchey | www.ScaryDBA.com SQL Server Configuration: CPU  CostThreshold for parallelism » 5, the default, is too low » OLTP = 40 » Reporting = 25  Max Degree of Parallelism » Leave it on, after you change the cost threshold  Consider using Query Governor » Set a cost limit 16
  • 17. Grant Fritchey | www.ScaryDBA.com SQL Server Configuration: Storage  TEMPDB » Separate from other data when possible » Multiple Files — Not equal to #of processors — Equal sized files  Compression » Minimum, index compression  More disks is better » But only if you have more controllers  Spend money » Buy faster disks 17
  • 18. Grant Fritchey | www.ScaryDBA.com SQL Server Administration  Maintain Statistics » Enable AUTO_CREATE & AUTO_UPDATE » You must also plan for manual updates » You may need FULL SCAN » Consider ASYNC  Defragment your indexes » Number of pages does matter » You can defrag below 1000 pages » You can’t defrag below 8 pages » Separate defrag & statistics updates 18
  • 19. Grant Fritchey | www.ScaryDBA.com SQL Server Administration 2  Avoid dangerous settings » Disable AUTO_CLOSE » Disable AUTO_SHRINK  Do not use the Profiler GUI on production systems » Create a server-side trace usingTSQL scripts (prior to 2008) » Use extended events — Consider for 2008 or better — Absolutely for 2012 or better  Set Blocked ProcessThreshold » Based on your system 19
  • 20. Grant Fritchey | www.ScaryDBA.com Database Design  Storage  Constraints  Indexes 20
  • 21. Grant Fritchey | www.ScaryDBA.com Database Design: Storage  Separate Log & Data  Multiple File Groups » Even on a single drive  Turn off auto-grow » If not possible, used fixed growth, not percentage  Consider In-Memory » 2014 only » I/O Latch waits 21
  • 22. Grant Fritchey | www.ScaryDBA.com Database Design: Constraints  Normalize your Data » Normalization benefits performance  Enforce Constraints » Foreign keys » Primary keys » Unique values 22
  • 23. Grant Fritchey | www.ScaryDBA.com Database Design: Indexes - General  Narrow » As narrow as possible  Integers » Believe it or not, they’re better  Choose leading edge carefully » Most selective column  Covering Indexes are fastest » Use INCLUDE 23
  • 24. Grant Fritchey | www.ScaryDBA.com Database Design: Indexes - Clustered  Again, Narrow » As narrow as possible  Design around the clustered index » Most frequent used path to data  Rebuilding clustered index » Use DROP_EXISTING  Avoid columns that get updated frequently » This means all non-clustered indexes are updated too 24
  • 25. Grant Fritchey | www.ScaryDBA.com TSQL Coding  Return only the data you need, when you need it  Use stored procedures or parameterized queries » Encourages plan reuse » Prevents SQL Injection  Avoid cursors,WHILE, LOOP » Row By Agonizing Row style processing  Qualify all object names » Reduces lookup costs  Avoid using ‘sp_*’ for procedure names » Eliminates additional read to the master database 25
  • 26. Grant Fritchey | www.ScaryDBA.com TSQL Coding 2  Avoid nonsargeable conditions » Meaning functions on columns » Or, using LIKE ‘%Anything’  Use SET NOCOUNT ON » Reduces returns on network  Do not nest views » Or join them. It confuses the optimizer  Don’t use optimizer hints » More often than not it causes problems » Especially NOLOCK 26
  • 27. Grant Fritchey | www.ScaryDBA.com TSQL Coding 3  Avoid Recompiling Execution Plans » Stored procedures & parameterized queries » Table variables instead of temp tables » ANSI standards on connection settings — And Don’t change them within a query » Don’t interleave DDL & DML  Adopt best practices for transactions » Keep scope as short as possible » Use SET XACT_ABORT » Consider using READ COMMITTED SNAPSHOT 27
  • 28. Grant Fritchey | www.ScaryDBA.com Relax  It’s not that bad  Most things can be changed  Help is available  Test everything 28
  • 29. Grant Fritchey | www.ScaryDBA.com Questions? 29