| About the Author |
|
xiii | |
| About the Technical Reviewer |
|
xv | |
| Acknowledgments |
|
xvii | |
| Introduction |
|
xix | |
|
Part I SQL Server Internals |
|
|
1 | (78) |
|
Chapter 1 How SQL Server Works |
|
|
3 | (64) |
|
|
|
4 | (2) |
|
|
|
6 | (1) |
|
|
|
6 | (1) |
|
|
|
7 | (2) |
|
|
|
9 | (4) |
|
|
|
13 | (1) |
|
|
|
14 | (4) |
|
|
|
18 | (4) |
|
|
|
22 | (3) |
|
Trivial Plan Optimization |
|
|
25 | (1) |
|
|
|
26 | (11) |
|
|
|
37 | (2) |
|
|
|
39 | (7) |
|
|
|
46 | (3) |
|
|
|
49 | (3) |
|
|
|
52 | (2) |
|
|
|
54 | (1) |
|
|
|
54 | (2) |
|
|
|
56 | (1) |
|
|
|
57 | (1) |
|
|
|
58 | (1) |
|
|
|
59 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (2) |
|
|
|
62 | (2) |
|
|
|
64 | (3) |
|
Chapter 2 SQL Server on Linux |
|
|
67 | (12) |
|
|
|
67 | (2) |
|
|
|
69 | (1) |
|
|
|
70 | (1) |
|
|
|
71 | (2) |
|
|
|
73 | (3) |
|
|
|
76 | (2) |
|
|
|
78 | (1) |
|
Part II Design and Configuration |
|
|
79 | (72) |
|
Chapter 3 SQL Server Configuration |
|
|
81 | (40) |
|
|
|
82 | (3) |
|
Standard Automatic Statistics Update |
|
|
85 | (1) |
|
|
|
85 | (1) |
|
|
|
86 | (1) |
|
Query Optimizer Hotfix Servicing Model |
|
|
86 | (2) |
|
Max degree of parallelism |
|
|
88 | (4) |
|
Cost threshold for parallelism |
|
|
92 | (1) |
|
Instant File Initialization |
|
|
93 | (2) |
|
|
|
95 | (1) |
|
Optimize for ad hoc workloads |
|
|
96 | (1) |
|
SQL Server Enterprise Edition |
|
|
97 | (1) |
|
|
|
98 | (2) |
|
|
|
100 | (1) |
|
Backup compression default |
|
|
101 | (1) |
|
Query governor cost limit |
|
|
101 | (1) |
|
Blocked process threshold |
|
|
102 | (1) |
|
|
|
103 | (1) |
|
Configuring SQL Server on Linux |
|
|
104 | (5) |
|
Using Environment Variables |
|
|
109 | (2) |
|
Performance Best Practices |
|
|
111 | (1) |
|
Memory and the Out-of-Memory Killer |
|
|
111 | (1) |
|
|
|
112 | (6) |
|
Additional Configurations |
|
|
118 | (1) |
|
|
|
119 | (2) |
|
Chapter 4 Tempdb Troubleshooting and Configuration |
|
|
121 | (30) |
|
|
|
122 | (4) |
|
Describing tempdb Latch Contention |
|
|
126 | (2) |
|
Fixing tempdb Latch Contention |
|
|
128 | (1) |
|
Using Multiple Data Files |
|
|
128 | (1) |
|
Trace Flags 1117 and 1118 |
|
|
129 | (1) |
|
SQL Server 2016 Enhancements |
|
|
130 | (3) |
|
What Is New in SQL Server 2019 |
|
|
133 | (1) |
|
Memory-Optimized tempdb Metadata |
|
|
133 | (5) |
|
|
|
138 | (6) |
|
|
|
144 | (1) |
|
|
|
144 | (1) |
|
|
|
145 | (1) |
|
|
|
146 | (1) |
|
|
|
147 | (1) |
|
|
|
147 | (2) |
|
|
|
149 | (2) |
|
|
|
151 | (80) |
|
Chapter 5 Analyzing Wait Statistics |
|
|
153 | (36) |
|
|
|
154 | (7) |
|
|
|
161 | (1) |
|
|
|
161 | (5) |
|
Sys.dm_exec_session_wait_stats |
|
|
166 | (1) |
|
|
|
166 | (4) |
|
System_health Extended Event Session |
|
|
170 | (3) |
|
Example: Analyzing CXPACKET Waits |
|
|
173 | (4) |
|
|
|
177 | (2) |
|
|
|
179 | (1) |
|
|
|
180 | (1) |
|
|
|
180 | (1) |
|
PAGELATCHJ* and PAGEIOLATCH_* |
|
|
180 | (1) |
|
|
|
180 | (1) |
|
|
|
181 | (1) |
|
|
|
181 | (1) |
|
|
|
181 | (1) |
|
|
|
182 | (1) |
|
|
|
182 | (1) |
|
|
|
182 | (1) |
|
|
|
182 | (2) |
|
What Is New on SQL Server 2019 |
|
|
184 | (1) |
|
|
|
185 | (1) |
|
|
|
186 | (1) |
|
|
|
187 | (2) |
|
Chapter 6 The Query Store |
|
|
189 | (42) |
|
|
|
189 | (1) |
|
|
|
190 | (1) |
|
How the Query Store Can Help |
|
|
191 | (1) |
|
|
|
192 | (1) |
|
|
|
192 | (1) |
|
Application/Hardware Changes |
|
|
193 | (1) |
|
Identify Expensive Queries |
|
|
193 | (1) |
|
Identify Ad Hoc Workloads |
|
|
193 | (1) |
|
|
|
194 | (3) |
|
Enabling, Purging, and Disabling the Query Store |
|
|
197 | (7) |
|
|
|
204 | (7) |
|
Performance Troubleshooting |
|
|
211 | (3) |
|
|
|
214 | (4) |
|
|
|
218 | (3) |
|
|
|
221 | (3) |
|
|
|
224 | (2) |
|
|
|
226 | (3) |
|
|
|
229 | (2) |
|
Part IV Performance Tuning and Troubleshooting |
|
|
231 | (158) |
|
Chapter 7 SQL Server In-Memory Technologies |
|
|
233 | (42) |
|
|
|
234 | (3) |
|
Enhancements After the Initial Release |
|
|
237 | (1) |
|
|
|
238 | (4) |
|
|
|
242 | (3) |
|
Natively Compiled Modules |
|
|
245 | (2) |
|
Changing Tables and Natively Compiled Modules |
|
|
247 | (3) |
|
|
|
250 | (2) |
|
Memory-Optimized Table Variables |
|
|
252 | (1) |
|
|
|
253 | (1) |
|
|
|
254 | (3) |
|
|
|
257 | (6) |
|
|
|
263 | (4) |
|
|
|
267 | (3) |
|
Using Memory-Optimized Tables |
|
|
270 | (4) |
|
|
|
274 | (1) |
|
Chapter 8 Performance Troubleshooting |
|
|
275 | (36) |
|
|
|
276 | (2) |
|
Comparing Batches and Transactions |
|
|
278 | (4) |
|
|
|
282 | (2) |
|
|
|
284 | (1) |
|
|
|
284 | (1) |
|
|
|
285 | (1) |
|
|
|
285 | (1) |
|
|
|
286 | (1) |
|
|
|
286 | (2) |
|
|
|
288 | (1) |
|
|
|
288 | (1) |
|
|
|
288 | (1) |
|
LogicalDisk and PhysicalDisk |
|
|
289 | (1) |
|
SQL Compilations/Sec and Recompilations/Sec |
|
|
289 | (1) |
|
|
|
290 | (1) |
|
|
|
290 | (1) |
|
|
|
290 | (1) |
|
|
|
291 | (1) |
|
|
|
291 | (1) |
|
Sys.dm_os_performance_counters |
|
|
292 | (1) |
|
Dynamic Management Views and Functions |
|
|
293 | (1) |
|
Sys.dm_io_virtual_file_stats |
|
|
293 | (3) |
|
|
|
296 | (1) |
|
Sys.dm_db_index_usage_st.ats |
|
|
296 | (2) |
|
|
|
298 | (1) |
|
Sys.dm_db_index_physical_stats |
|
|
299 | (2) |
|
Sys.dm_exec_query_optimizer_info |
|
|
301 | (1) |
|
|
|
302 | (1) |
|
|
|
303 | (1) |
|
|
|
304 | (1) |
|
SQL Trace/Extended Events |
|
|
304 | (2) |
|
SQL Server Data Collector |
|
|
306 | (2) |
|
Operator-Level Performance Statistics |
|
|
308 | (1) |
|
|
|
309 | (1) |
|
|
|
310 | (1) |
|
|
|
311 | (38) |
|
How SQL Server Uses Indexes |
|
|
312 | (3) |
|
|
|
315 | (2) |
|
|
|
317 | (2) |
|
|
|
319 | (1) |
|
|
|
320 | (1) |
|
|
|
321 | (1) |
|
|
|
322 | (1) |
|
|
|
323 | (1) |
|
|
|
324 | (11) |
|
The Missing Indexes Feature |
|
|
335 | (3) |
|
The Database Engine Tuning Advisor |
|
|
338 | (9) |
|
|
|
347 | (2) |
|
Chapter 10 Intelligent Query Processing |
|
|
349 | (16) |
|
Batch Mode Adaptive Joins |
|
|
350 | (3) |
|
|
|
353 | (2) |
|
|
|
355 | (4) |
|
|
|
359 | (1) |
|
Table Variable Deferred Compilation |
|
|
360 | (1) |
|
|
|
361 | (1) |
|
Approximate Count Distinct |
|
|
362 | (1) |
|
|
|
363 | (2) |
|
Chapter 11 SQL Server Storage |
|
|
365 | (24) |
|
|
|
367 | (1) |
|
|
|
368 | (1) |
|
|
|
369 | (1) |
|
|
|
370 | (1) |
|
|
|
371 | (1) |
|
|
|
372 | (1) |
|
|
|
373 | (1) |
|
|
|
373 | (2) |
|
|
|
375 | (1) |
|
|
|
376 | (3) |
|
|
|
379 | (2) |
|
|
|
381 | (1) |
|
|
|
381 | (1) |
|
|
|
382 | (1) |
|
|
|
382 | (1) |
|
|
|
383 | (1) |
|
|
|
384 | (1) |
|
|
|
385 | (1) |
|
|
|
385 | (1) |
|
|
|
386 | (1) |
|
|
|
387 | (2) |
| Index |
|
389 | |