Hitting the SQL Server “Go Faster” Button Rob Douglas #479 SQL Saturday South Island
Sponsors Please make sure you visit our fantastic sponsors: SQL SATURDAY | #479 | South Island 2016
Robert Douglas Consultant for SQL Services Limited BA(hons),MCTS, MCITP(2005/2008), MCSA(2012) Consultant for SQL Services Limited Christchurch\Nelson SQL Server Users Group Passionate about Data (Are you impressed?) SQL SATURDAY | #479 | South Island 2016
Robert Douglas Consultant for SQL Services Limited BA(hons),MCTS, MCITP(2005/2008), MCSA(2012) Consultant for SQL Services Limited Christchurch\Nelson SQL Server Users Group Passionate about Data Doing a Good Job SQL SATURDAY | #479 | South Island 2016
The SQL Server “Go Faster” Button SQL SATURDAY | #479 | South Island 2016
The SQL Server “Go Faster” Button There isn’t one. But…. There are a lot of knobs and switches that, when used appropriately, can make a huge difference! Today we will focus on low effort, high return. Individual query tuning is very resource intensive. Many consolidated databases on one server. 3rd party products and can’t directly adjust queries. Prioritizing your time to the best return for the business. Takeaways – a list of options you can apply to your own systems. SQL SATURDAY | #479 | South Island 2016
The SQL Server “Go Faster” Button There isn’t one. But…. There are a lot of knobs and switches that, when used appropriately, can make a huge difference! Today we will focus on low effort, high return. Individual query tuning is very resource intensive. Many consolidated databases on one server. 3rd party products and can’t directly adjust queries. Prioritizing your time to the best return for the business. Takeaways – a list of options you can (test and then)apply to your own systems. SQL SATURDAY | #479 | South Island 2016
Where Can We Get Gains? Hardware Windows Configuration Instance and Database Settings Maintenance Non-Code Changes. Run This: SQL Best Practices Analyzer SQL SATURDAY | #479 | South Island 2016
Hardware
Hardware It’s not cheating! Memory IO CPU In fact often it is the best return on investment you can get. Memory IO CPU SQL SATURDAY | #479 | South Island 2016
Memory Set Maximum Server Memory appropriately Lock Pages in Memory Ignore the (Very Old) pagefile = 1.5 x RAM recommendation. SQL SATURDAY | #479 | South Island 2016
IO (Not disk) Faster the better 64K Block Size and Disk Partition Alignment Dedicated drive Degree of Isolation. Remove IO bottleneck by decreasing load or increasing capacity. SQL SATURDAY | #479 | South Island 2016
CPU Cost Implications for Licensing Be Aware of Your Edition Limits Some SQL Server Level Settings which effect this. SQL SATURDAY | #479 | South Island 2016
Network
Server Level
Windows Level Power Saving Settings Lock Pages in Memory Bios and Windows Level Lock Pages in Memory Instant File Initialization(Perform Volume Maintenance Tasks) Data File Only Small Security Risk(But not really) Dedicate the Windows Server to SQL Server. Exclude SQL from applications using filter drivers(Such as Anti-Virus). Try and keep windows patches up to date. SQL SATURDAY | #479 | South Island 2016
Virtual Machines Can perform (nearly) as well as a physical machine. VM Memory to avoid ballooning Don’t overcommit resources Understand when and where the Virtual Machine can be moved. Understand what that means for licensing! Method of disk provisioning. Power Savings counts here too! SQL SATURDAY | #479 | South Island 2016
SQL Server Level Settings Optimize for Ad Hoc Workloads Compression Backup Compression Page or Row Compression Maximum Degree of Parallelism Cost Threshold of Parallelism. Trace Flags 1117,1118,3226,2371,4199, 1117 – grow files equally 1118 – mixed extents 3226 – remove backup success messages, 2371 – changes auto-update-stats thresholds. FROM 500+205 the size of table. 4199 – Turn on query optimizer changes by default. SQL SATURDAY | #479 | South Island 2016
Database Level
Database Settings Data and Log File Sizing Transaction Isolation Level Autogrow should be a failsafe, but scope it accordingly. Avoid AutoShrink, and manual shrink unless you will never grow it again. VLF’s Find them with DBCC Loginfo 2014 does it better. Transaction Isolation Level SQL SATURDAY | #479 | South Island 2016
TempDB Settings Multiple Data Files to avoid Contention Presize and keep all files the same size. Review the filesize, particularly if you change your usage pattern. TraceFlags that can help: T1117 for equal file growth. T1118 for allocation of mixed extents. SQL SATURDAY | #479 | South Island 2016
Ongoing Maintenance
Indexes and Maintenance Indexes can make a significant effect on individual queries They come at a cost – slower writes Apply the common sense filter to ‘missing index’ recommendations. Fill Factor Maintenance Rebuild or Re-Organize Update Statistics Backups What and how often? And who? SQL SATURDAY | #479 | South Island 2016
Questions Please make sure you visit our fantastic sponsors: SQL SATURDAY | #479 | South Island 2016