liveBook · Manning

What you will learn in 100 SQL Server Mistakes and How to Avoid Them

by Peter Carter

Chapter by chapter

Chapter 1: Introducing SQL Server

1.1 The SQL Server index mistake (mistake #0) · 1.2 An overview of SQL Server · 1.2.1 Overview of the Database Engine · 1.2.2 Heterogeneous platforms · 1.3 Why we should still care about SQL Server · 1.4 Why getting SQL Server right matters · 1.5 Summary

What you learn in chapter 1 →

Chapter 2: Development standards

2.1 An example mistake · 2.2 #1 Nondescriptive object names · 2.3 #2 Using object prefixes · 2.4 #3 The dreaded sp_ prefix · 2.5 #4 Not making time for coding standards · 2.6 #5 Using ordinal column position · 2.7 Summary

What you learn in chapter 2 →

Chapter 3: Data types

3.1 #6 Always storing whole numbers in INT · 3.2 #7 Always using variable-length strings · 3.3 #8 Writing your own hierarchy code · 3.4 #9 Not storing XML data as native XML · 3.4.1 Shredding XML · 3.4.2 Reconstructing XML · 3.4.3 Avoiding the overhead by storing data as XML · 3.5 #10 Ignoring JSON · 3.6 Summary

What you learn in chapter 3 →

Chapter 4: Database design

4.1 #11 Failing to normalize · 4.1.1 Designing a schema using judgment · 4.1.2 Problems with our database schema · 4.1.3 Designing a database schema using normalization · 4.2 #12 Using a wide primary key · 4.3 #13 Not using foreign keys · 4.4 Summary

What you learn in chapter 4 →

Chapter 5: T-SQL development

5.1 #14 Dealing incorrectly with NULL values · 5.2 #15 Using NOLOCK as a performance tweak · 5.3 #16 Using SELECT * as standard · 5.4 #17 Unnecessarily ordering data · 5.5 #18 Using DISTINCT without good reason · 5.6 #19 Using UNION unnecessarily · 5.7 #20 Using cursors · 5.8 #21 Deleting many rows in a single transaction · 5.9 Summary

What you learn in chapter 5 →

Chapter 6: SSIS development

6.1 #22 Throwing away bad data · 6.2 #23 Not optimizing data loads · 6.3 #24 Using SSIS as a T-SQL orchestration tool · 6.3.1 Creating an Execute T-SQL Statement orchestration · 6.3.2 Converting Execute T-SQL Statement tasks to data flows · 6.4 #25 Extracting all data when we only need a subset · 6.5 Summary

What you learn in chapter 6 →

Chapter 7: Error handling, testing, source control, and deployment

7.1 #26 Writing code that doesn’t handle errors · 7.2 #27 Failing to alert on errors · 7.3 #28 Not utilizing debugging functionality · 7.4 #29 Not making use of Schema Compare · 7.5 #30 Failing to write unit tests · 7.6 Modern development techniques · 7.6.1 #31 Not keeping code in source control · 7.6.2 #32 Not deploying code with a CI/CD pipeline · 7.7 Summary

What you learn in chapter 7 →

Chapter 8: SQL Server installation

8.1 #33 Using obscure instance names · 8.2 #34 Using Windows indiscriminately · 8.3 #35 Forgetting how useful containers can be · 8.4 #36 Using Desktop Experience unnecessarily · 8.5 #37 Using Enterprise Edition indiscriminately · 8.6 #38 Installing an instance when DBaaS or PaaS will suffice · 8.7 #39 Installing all features · 8.8 #40 Not scripting SQL Server installation · 8.9 #41 Thinking configuration management doesn’t apply to SQL Server · 8.10 #42 Using SQL Server cloud images without modifying them · 8.11 Summary

What you learn in chapter 8 →

Chapter 9: Instance and database management

9.1 #43 Autoshrinking databases · 9.2 #44 Failing to rebuild indexes after data file shrink · 9.3 #45 Relying on autogrow · 9.4 #46 Using multiple log files · 9.5 #47 Allowing logs to become fragmented · 9.6 #48 Failing to capacity plan · 9.7 #49 Always placing TempDB and log files on dedicated drives · 9.8 #50 Not regularly checking for corruption · 9.9 #51 Failing to automate · 9.10 #52 Using cursors for administrative purposes · 9.11 #53 Failing to patch · 9.12 Summary

What you learn in chapter 9 →

Chapter 10: Optimization

10.1 #54 Turning on TF1117 and TF1118 · 10.2 #55 Not using instant file initialization · 10.3 #56 Failing to leave enough memory for other applications · 10.4 #57 Failing to lock pages in memory · 10.5 #58 Working against the optimizer · 10.6 #59 Not taking advantage of DOP feedback · 10.7 #60 Not partitioning large tables · 10.8 #61 Not understanding the limitations of partition elimination · 10.9 #62 Not compressing large tables · 10.10 #63 Using Read Uncommitted · 10.11 #64 Using unnecessarily strong isolation levels · 10.12 #65 Not considering optimistic isolation levels · 10.13 #66 Throwing more hardware at the problem · 10.14 Summary

What you learn in chapter 10 →

Chapter 11: Indexes

11.1 #67 Assuming internal fragmentation is always bad · 11.2 #68 Believing that external fragmentation causes problems for all queries · 11.3 #69 Reorganizing indexes to fix page density · 11.4 #70 Misinterpreting fragmentation statistics · 11.5 #71 Not rebuilding indexes · 11.6 #72 Rebuilding all indexes indiscriminately · 11.7 #73 Updating statistics after rebuilding indexes · 11.8 #74 Not optimizing index maintenance for our needs · 11.8.1 Considerations for MAXDOP · 11.8.2 Considerations for SORT_IN_TEMPDB · 11.8.3 Understanding OPTIMIZE_FOR_SEQUENTIAL_KEY · 11.9 #75 Not disabling indexes for bulk load · 11.10 #76 Relying too heavily on Database Engine Tuning Advisor · 11.11 #77 Not using columnstore indexes · 11.12 Summary

What you learn in chapter 11 →

Chapter 12: Backups

12.1 #78 Not considering RPO and RTO · 12.2 #79 Using database snapshots as a recovery strategy · 12.3 #80 Using crash-consistent snapshots as a recovery strategy · 12.4 #81 Not testing backups · 12.4.1 Checking that backups completed successfully · 12.4.2 Verifying backup integrity · 12.5 #82 Taking backups during an ETL window · 12.6 #83 Always using the FULL recovery model on data warehouse and development systems · 12.7 #84 Using SIMPLE recovery model for OLTP databases · 12.8 #85 Not backing up after changing recovery model · 12.9 #86 Scheduling log backups immediately after a full backup · 12.10 #87 Not using COPY_ONLY backups for ad hoc backups · 12.11 #88 Forgetting that backups are part of our security posture · 12.12 Summary

What you learn in chapter 12 →

Chapter 13: Availability

13.1 #89 Confusing HA and DR · 13.2 #90 Failing to architect for the requirements · 13.3 #91 Not testing the DR strategy · 13.4 #92 Assuming availability groups are always the right answer · 13.5 #93 Overloading a cluster · 13.6 Summary

What you learn in chapter 13 →

Chapter 14: Security

14.1 #94 Not implementing the principle of least privilege · 14.2 #95 Not disabling the sa account · 14.3 #96 Using the wrong granularity of a service account · 14.4 #97 Enabling xp_cmdshell · 14.5 #98 Failing to audit administrative activity · 14.6 #99 Exposing the business to whole-value substitution attacks · 14.6.1 Preparing an encrypted environment · 14.6.2 Understanding and preventing whole-value substitution attacks · 14.7 #100 Exposing the business to SQL injection attacks · 14.8 Summary

What you learn in chapter 14 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.