Making DBCC CHECKDB Go Faster Argenis Fernandez Senior Database Engineer

Slides:



Advertisements
Similar presentations
SQL Server Disaster Recovery Chris Shaw Sr. SQL Server DBA, Xtivia Inc.
Advertisements

Mecanismos de alta disponibilidad con Microsoft SQL Server 2008 Por: ISC Lenin López Fernández de Lara.
SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server.
Backup, Integrity Check and Index and Statistics Maintenance
SharePoint and SQL Server integration Demo: SQL Server Optimizing Configurations SQL Server 2014 for SharePoint 2013 Avoiding ginormous transaction.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
Backup, Integrity Check and Index and Statistics Maintenance
SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312.
Presented by Jacob Wilson SharePoint Practice Lead Bross Group 1.
Optimizing SQL Server 2012 for SharePoint 2013 SharePoint Saturday/Friday, Honolulu March 27, 2015.
Russ Houberg Senior Technical Architect, MCM KnowledgeLake, Inc.
SAP on windows server 2012 hyper-v documentation
SQL Server 2008 & Solid State Drives Jon Reade SQL Server Consultant SQL Server 2008 MCITP, MCTS Co-founder SQLServerClub.com, SSC
Virtual techdays INDIA │ September 2011 Tips for Successful SQL Server Deployment in Enterprise Environment Balmukund Lakhani │ Technical Lead –
Bill Baer is a Senior Product Marketing Manager and Microsoft Certified Master for SharePoint in the SharePoint product group in Redmond, Washington;
Implementing Database Snapshot & Database Mirroring in SQL Server 2005 Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP Microsoft.
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Agenda for Today Do Chapter 14 Final Project Review for Final.
(C) 2008 Clusterpoint(C) 2008 ClusterPoint Ltd. Empowering You to Manage and Drive Down Database Costs April 17, 2009 Gints Ernestsons, CEO © 2009 Clusterpoint.
Module 16: Performing Ongoing Database Maintenance
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
Connect with life Vinod Kumar Technology Evangelist - Microsoft
Alwayson Availability Groups
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
SQL SERVER MAINTENANCE PLANS Kat
Strategies for Working with Texas-sized Databases Robert L Davis Database Engineer
Get the Most out of SQL Server Standard Edition Or How to be a SQL Miser.
Rolling Upgrades, The Easy Way Argenis Fernandez Senior Database Engineer,
SQL Server 2016 – New Features Tilahun Endihnew March 12, 2016.
SQL Server High Availability Introduction to SQL Server high availability solutions.
Configuring SQL Server for a successful SharePoint Server Deployment Haaron Gonzalez Solution Architect & Consultant Microsoft MVP SharePoint Server
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
New Instance… Now What? Presented by: James Donahoe Senior Solutions Engineer – TeleTracking Technologies MCSA: SQL Server 2012.
Dealing with Database Corruption DBA 911. Who am I? 2 David M Maxwell twitter.com/dmmaxwell or twitter.com/upsearchsqltwitter.com/dmmaxwelltwitter.com/upsearchsql.
SQL Server Magic Buttons! What are Trace Flags and why should I care? Steinar Andersen, SQL Service Nordic AB Thanks to Thomas Kejser for peer-reviewing.
High Availability & Disaster Recovery with SQL Server AlwaysOn Availability Groups Turgay Sahtiyan Microsoft – Senior SQL Server PFE
Turgay Sahtiyan Istanbul, Turkey
Sponsors.
Get the Most out of SQL Server Standard Edition
You Inherited a Database Now What?
Automated Restore Script Output for Ola Hallengren’s Maintenance Solution 1) Start SQL Services on Local 2) Connect to Azure AlwaysOn 3) Delete all maintenance.
Database Corruption Advanced Recovery Techniques|
Very Large Databases in your future
Designing Database Solutions for SQL Server
Windows Azure Migrating SQL Server Workloads
Performance Tuning 101: Parallelism
Contained DB? Did it do something wrong?
Introduction to SQL Server Management for the Non-DBA
Code-Less Securing of SQL Server
The Top 5 SQL Server Mistakes
Database Administration for the Non-DBA
Boring is stable, stable is good - best practices in practice
Dynamics AX Performance
Database Corruption Advanced Recovery Techniques
Understanding and Handling Database Corruption
Welcome to SQL Saturday Denmark
Peter Shore SQL Saturday Cleveland 2016
Database Corruption Advanced Recovery Techniques
Very large Databases in your future Eric Peterson.
Database Corruption Advanced Recovery Techniques
Backup to Basics Tom Fox
AlwaysOn Availability Groups
Transaction Log Internals and Performance David M Maxwell
You Inherited a Database Now What?
Advanced Recovery Techniques
Hybrid Buffer Pool The Good, the Bad and the Ugly
The DBA Quit and now you’re it:
Presentation transcript:

Making DBCC CHECKDB Go Faster Argenis Fernandez Senior Database Engineer

About your Speaker Today… Member of the Database Engineering team at SurveyMonkey Formerly: Senior Consultant, Microsoft Consulting Services & Senior DBA at Outerwall and Ultimate Software Microsoft Certified Master: SQL Server 2008, Microsoft Certified Solutions Master: Charter - Data Platform 2014 Friend of Red Gate Software Idera SQL Server ACE DBA/Dev/SysAdmin for 15 years Loves Windows and SQL Server Internals Regular Speaker (PASS Summit, PASS SQLRally, SQLBits XI, TechEd 2013, IT/DevConnections) Twitter enthusiast; infrequent blogger.

Why Am I Qualified To Speak About This? My name is not Paul Randal I took consistency checks on our 8.4TB database from 9+ days down to 10 hours on slower storage, 6 hours on an all-flash array Note: This session lasts < 60 minutes, so we are not going to watch paint dry

Making DBCC CHECKDB Go Faster Get the biggest server you can find with the fastest CPUs, all the RAM you can pack on it and all PCI-Express based storage Tune Windows Tune SQL Server You’re Done!

Consistency Checks? Why Should I Care?

What Causes Corruption?

What Should Be My Goal? What Am I Trying To Achieve?

What Should Be My Goal? To try to make DBCC CHECKDB run as fast as possible? No, you cannot really measure as fast as possible. Use a baseline, but which one? BACKUP DATABASE TO DISK = ‘NUL’ That is your theoretical “limit”

What Kind Of Hardware Do I Need?

Obviously the fastest, biggest the better, but: It’s perfectly okay to offload consistency checks to a smaller, slower box knowing that it’ll take longer, but you will not impact your production instance AS LONG as you run WITH PHYSICAL_ONLY checks on the primary/prod instance In that case, it can be commodity hardware

Offloading Consistency Checks

Where Is It Okay To Offload Consistency Checks To? Log Shipping Secondary on STANDBY? Snapshot on a Mirroring Partner? Replication Subscriber? AlwaysOn Availability Groups Readable Secondary? Restored copy of the prod database from a fresh FULL backup? SAN Snapshot?

What Does CHECKDB Actually Do?

Breakdown of DBCC CHECKDB Tasks DBCC CHECKALLOC DBCC CHECKTABLE DBCC CHECKCATALOG Checks metadata and filesystem directories/files for FILESTREAM Checks Service Broker structures Breaking down these processes separately might be a good choice if you have extremely large databases

Great, But How Do I Make It Go Faster??

Check Your Power Plan On Windows Default is “Balanced” – awful Set to “High Performance” Use powercfg.cpl or powercfg.exe to correct Consider disabling all power saving features in your server’s BIOS/UEFI settings Verify you are okay by leveraging CPU-Z from

tempdb Defaults Suck. Fix them. tempdb’s default data file size sucks (8MB data/1MB log) Its autogrowth settings suck (10% for both files) The number is tempdb files is usually not optimal PFS/SGAM/GAM contention can be observed in a lot of systems Increase to # of files = # of cores to begin with for <= 8 cores For > 8 cores increase by 4 as long as you see contention For a good brain-melting discussion on tempdb, watch Bob Ward’s “Inside Tempdb” talk at the 2011 PASS Summit, available here: bit.ly/1gF3qi6bit.ly/1gF3qi6 Run DBCC CHECKDB WITH ESTIMATEONLY to get an idea of how much tempdb space consistency checks will require

The Default MAXDOP Sucks. Fix It. CHECKDB can and will go parallel on Enterprise Edition MAXDOP default is zero Change to number of cores per NUMA node Use SysInternals’ COREINFO.EXE to find out how many Cores/NUMA node in your system Check out Paul Randal’s blog post on CHECKDB DOP scalability performance-benchmarking-on-ssds/ performance-benchmarking-on-ssds/ You can choose to turn off parallelism for CHECKDB with Trace Flag 2528

Consider BYOS: Bring Your Own Snapshot Applies to Enterprise Edition only CHECKDB creates an internal snapshot to obtain a consistent view of the database before it performs any checks You can choose to roll your own snapshot and run CHECKDB against it You can choose to keep the NTFS alternate stream (copy-on-write) files on different storage

Consider Using WITH TABLOCK, go Single-User, or Read-Only Probably not feasible in your environment Database is not available to regular users No snapshot needed, nor one is created

Consider Using Trace Flags Trace Flags 2549 and 2562 were specifically created to increase performance of CHECKDB on very large databases Documented in this KB: Aaron Bertrand has a list of builds that support these trace flags here: checkdb - the _entire_ article is a must read checkdb Although developed specifically to increase WITH PHYSICAL_ONLY performance, the KB acknowledges that they can also increase the performance of full checks – and we have observed that they do help a bit in our environment [CAUTION] Test carefully – these might have a negative impact on performance!

Consider Disabling/Dropping Certain Non-Clustered Indexes On Computed Columns computed-column-indexes/ computed-column-indexes/ Filtered on Sparse Columns checkdb-on-vvldb-and-latches-or-my-pain-is-your-gain.aspx checkdb-on-vvldb-and-latches-or-my-pain-is-your-gain.aspx Blame the expression evaluator

Consider Limiting The Memory Available to CHECKDB Wait, WHAT??? CHECKDB grossly overestimates the amount of memory it will need to execute, stealing pages from the Buffer Pool and decreasing overall performance Use Resource Governor to limit. Enterprise Edition only memory-grants-not-quite-what-you-expect/ memory-grants-not-quite-what-you-expect/ Our tests point to a 1GB of execution memory is usually optimal

Questions?

Thank You!

Resources Ola Hallengren’s Maintenance solution: Paul Randal’s blog, CHECKDB category: angle/ angle/

Contact