Introduction |
|
xxi | |
Assessment Test |
|
xxx | |
|
|
1 | (42) |
|
Determining the Right Access Method |
|
|
2 | (17) |
|
Designing Appropriate Data Access Technologies |
|
|
3 | (12) |
|
Designing an Appropriate Data Access Object Model |
|
|
15 | (4) |
|
Deciding When to Implement Cursors |
|
|
19 | (6) |
|
Deciding When to Use Cursors |
|
|
19 | (1) |
|
Designing a Cursor Strategy for a Data Access Component |
|
|
20 | (1) |
|
Deciding How to Maximize Cursor Performance |
|
|
20 | (2) |
|
Detecting Which Applications Are Using Cursors and Evaluating Whether to Remove Them |
|
|
22 | (3) |
|
Making the Cursored Choice |
|
|
25 | (1) |
|
|
25 | (9) |
|
Designing Caching Strategies |
|
|
25 | (3) |
|
Selecting ADO.NET Caching |
|
|
28 | (3) |
|
Designing Custom Caching Functionality |
|
|
31 | (1) |
|
Designing a Refresh Strategy for Cached Data |
|
|
32 | (2) |
|
|
34 | (1) |
|
|
35 | (1) |
|
|
36 | (4) |
|
Answers to Review Questions |
|
|
40 | (3) |
|
Designing Application Access |
|
|
43 | (42) |
|
Implementing Client Libraries |
|
|
44 | (2) |
|
Using Management Object Applications |
|
|
46 | (21) |
|
Designing Server Management Objects (SMO) Applications |
|
|
47 | (11) |
|
Designing Replication Management Objects (RMO) Applications |
|
|
58 | (3) |
|
Designing Automation Management Objects (AMO) Applications |
|
|
61 | (3) |
|
Designing SQL Server Networking Interface (SNI) for Asynchronous Queries---Or, ``It Starts at the Endpoint!'' |
|
|
64 | (3) |
|
Simplifying Application Design |
|
|
67 | (9) |
|
Understanding the Features of MARS |
|
|
69 | (1) |
|
Understanding Row Versioning and MARS |
|
|
70 | (1) |
|
Designing Queries That Use Multiple Active Result Sets (MARS) |
|
|
71 | (1) |
|
Deciding When MARS Queries Are Appropriate |
|
|
72 | (2) |
|
Using MARS and the SQL Server Lock Manager |
|
|
74 | (1) |
|
Choosing How to Get the Max from MARS |
|
|
75 | (1) |
|
|
76 | (1) |
|
|
77 | (1) |
|
|
78 | (4) |
|
Answers to Review Questions |
|
|
82 | (3) |
|
|
85 | (48) |
|
|
87 | (12) |
|
Understanding behind the Scenes: The Procedure Cache |
|
|
87 | (1) |
|
Understanding the Different Types of Query Plans That Promote Reuse |
|
|
88 | (4) |
|
Understanding Best Practices for Reusing and Recompiling Plans |
|
|
92 | (1) |
|
Understanding the Cached Batch |
|
|
93 | (1) |
|
Using Showplan to View Your Query Plans |
|
|
94 | (3) |
|
Improving Query Performance |
|
|
97 | (1) |
|
Modifying Queries to Improve Performance |
|
|
97 | (2) |
|
Understanding the Sea Is Full of XML |
|
|
99 | (22) |
|
Designing Queries Using XQuery |
|
|
99 | (7) |
|
Using XQuery with the XML Data Type in SQL Server 2005 |
|
|
106 | (7) |
|
Using XML Data Modification Language |
|
|
113 | (6) |
|
Binding and Parameterizing XML Queries with Relational Data |
|
|
119 | (2) |
|
Guidelines for Processing XML Queries |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
124 | (7) |
|
Answers to Review Questions |
|
|
131 | (2) |
|
|
133 | (36) |
|
Understanding Data Access in Relational Data Systems |
|
|
134 | (10) |
|
Understanding Result Set--Based Operations |
|
|
135 | (1) |
|
Understanding Row-Based Operations |
|
|
136 | (3) |
|
Deciding When Cursors or Set-Oriented Operations Are Appropriate |
|
|
139 | (5) |
|
Selecting Cursors Appropriately |
|
|
144 | (16) |
|
Selecting Appropriate Server-Side Cursors |
|
|
144 | (16) |
|
Selecting Appropriate Client-Side Cursors |
|
|
160 | (1) |
|
|
160 | (1) |
|
|
161 | (1) |
|
|
162 | (4) |
|
Answers to Review Questions |
|
|
166 | (3) |
|
|
169 | (70) |
|
Designing Code That Validates Input Data and Permissions |
|
|
170 | (17) |
|
Considering All User Input to Be Malicious |
|
|
170 | (10) |
|
Understanding the Principle of the Least Privilege |
|
|
180 | (7) |
|
Designing Code That Detects and Reacts to Errors |
|
|
187 | (34) |
|
Understanding the Structure of an Error |
|
|
187 | (1) |
|
Understanding the Levels of Severity |
|
|
188 | (1) |
|
|
189 | (2) |
|
|
191 | (23) |
|
|
214 | (2) |
|
Handling Errors in Applications |
|
|
216 | (2) |
|
|
218 | (2) |
|
|
220 | (1) |
|
Designing SQL Server User-Defined Messages to Communicate Application Events |
|
|
221 | (8) |
|
The sys.messages Catalog View |
|
|
222 | (1) |
|
|
223 | (1) |
|
|
224 | (1) |
|
|
225 | (1) |
|
|
225 | (1) |
|
|
226 | (3) |
|
|
229 | (1) |
|
|
229 | (1) |
|
|
230 | (7) |
|
Answers to Review Questions |
|
|
237 | (2) |
|
Planning a Transaction Strategy |
|
|
239 | (66) |
|
Managing Concurrency by Selecting the Appropriate Transaction Isolation Levels |
|
|
240 | (30) |
|
|
241 | (1) |
|
Locking in the Database Engine |
|
|
242 | (5) |
|
|
247 | (5) |
|
|
252 | (1) |
|
Database Engine Isolation Levels |
|
|
252 | (18) |
|
Designing the Locking Granularity Level |
|
|
270 | (8) |
|
|
270 | (6) |
|
Customizing Index Locking Behavior |
|
|
276 | (2) |
|
Designing Transaction Scopes |
|
|
278 | (9) |
|
|
279 | (1) |
|
|
280 | (1) |
|
|
280 | (2) |
|
Batch-Scoped Transactions |
|
|
282 | (4) |
|
|
286 | (1) |
|
|
286 | (1) |
|
Designing Code That Uses Transactions |
|
|
287 | (10) |
|
Using Explicit Transactions |
|
|
287 | (7) |
|
|
294 | (1) |
|
Using Distributed Transactions |
|
|
294 | (2) |
|
|
296 | (1) |
|
|
297 | (1) |
|
|
297 | (1) |
|
|
298 | (6) |
|
Answers to Review Questions |
|
|
304 | (1) |
|
Optimizing and Tuning Queries for Performance |
|
|
305 | (60) |
|
Evaluating Query Performance |
|
|
306 | (41) |
|
Understanding the Query Life Cycle: High-Level View |
|
|
306 | (2) |
|
Understanding the Query Life Cycle: A Closer Look |
|
|
308 | (7) |
|
|
315 | (16) |
|
|
331 | (5) |
|
Testing Queries for Improved Performance |
|
|
336 | (4) |
|
Detecting Locking Problems |
|
|
340 | (7) |
|
Modifying Queries to Optimize Performance |
|
|
347 | (6) |
|
Modifying Queries to Optimize Client and Server Performance |
|
|
347 | (1) |
|
Rewriting Subqueries to Joins |
|
|
348 | (2) |
|
Designing Queries That Have Search Arguments (SARGs) |
|
|
350 | (1) |
|
Converting Single-Row Statements into Set-Based Queries |
|
|
351 | (2) |
|
|
353 | (1) |
|
|
353 | (2) |
|
|
355 | (7) |
|
Answers to Review Questions |
|
|
362 | (3) |
|
Optimizing Indexing Strategies |
|
|
365 | (56) |
|
Designing an Index Strategy |
|
|
366 | (24) |
|
|
366 | (1) |
|
|
366 | (1) |
|
|
367 | (1) |
|
Heaps, Clustered, and Nonclustered Indexes |
|
|
368 | (7) |
|
|
375 | (1) |
|
|
376 | (1) |
|
|
377 | (3) |
|
Indexes on Computed Columns |
|
|
380 | (3) |
|
Indexes with Included Columns |
|
|
383 | (2) |
|
|
385 | (4) |
|
|
389 | (1) |
|
Creating and Maintaining Indexes |
|
|
390 | (19) |
|
|
390 | (2) |
|
|
392 | (1) |
|
Performing Online Index Operations |
|
|
393 | (1) |
|
Finding the Missing Index |
|
|
393 | (6) |
|
|
399 | (7) |
|
|
406 | (3) |
|
|
409 | (1) |
|
|
409 | (1) |
|
|
410 | (8) |
|
Answers to Review Questions |
|
|
418 | (3) |
|
|
421 | (30) |
|
Preparing to Leverage Your Database Applications |
|
|
422 | (3) |
|
|
422 | (1) |
|
Stepping Up to Create a Well-Performing Database Application |
|
|
423 | (2) |
|
Leveraging Your Database Applications |
|
|
425 | (9) |
|
Deciding to Scale Up or Scale Out |
|
|
425 | (1) |
|
Scaling Out Data through Partitioning |
|
|
426 | (8) |
|
Understanding Scaleout Solutions |
|
|
434 | (9) |
|
Scaleout Using Scalable Shared Databases |
|
|
435 | (1) |
|
Scaleout Using Peer-to-Peer Replication |
|
|
436 | (2) |
|
Scaleout Using Linked Servers and Distributed Queries |
|
|
438 | (1) |
|
Scaleout Using Distributed Partitioned Views |
|
|
438 | (1) |
|
Scaleout Using Data-Dependent Routing |
|
|
439 | (1) |
|
Scaleout Using Service-Oriented Data Architecture (SODA) |
|
|
440 | (3) |
|
|
443 | (1) |
|
|
443 | (1) |
|
|
444 | (4) |
|
Answers to Review Questions |
|
|
448 | (3) |
|
Resolving Performance Problems |
|
|
451 | (58) |
|
|
452 | (6) |
|
Using Performance-Related Tools |
|
|
452 | (2) |
|
|
454 | (2) |
|
Performance Monitoring Recommendations |
|
|
456 | (1) |
|
Finding Out the Cause of Performance Problems |
|
|
457 | (1) |
|
Troubleshooting Database Design |
|
|
458 | (6) |
|
Rule 1: Pay Attention to a High Frequency of Queries Having More Than Four Join Operations |
|
|
458 | (1) |
|
Rule 2: Avoid Using More Than Three Indexes for Frequently Updated Tables |
|
|
459 | (2) |
|
Rule 3: Look for Large I/O Activity Due to Table Scans or Range Scans (scans >2) |
|
|
461 | (2) |
|
Rule 4: Remove Unused Indexes |
|
|
463 | (1) |
|
Troubleshooting CPU Problems |
|
|
464 | (19) |
|
Scheduling in SQL Server 2005 |
|
|
464 | (2) |
|
Rule 1: Watch Out for Signal Waits Greater Than 25 Percent |
|
|
466 | (1) |
|
Rule 2: Strive for More Than 90 Percent Plan Reuse |
|
|
467 | (1) |
|
Rule 3: Decide Whether Parallelism Is the Best Choice for Your Environment |
|
|
468 | (3) |
|
|
471 | (1) |
|
Additional Causes for CPU Problems |
|
|
471 | (12) |
|
Troubleshooting Memory Problems |
|
|
483 | (2) |
|
Rule 1: The Average Page Life Expectancy Should Be Greater Than 300 Seconds |
|
|
483 | (1) |
|
Rule 2: Watch Out for Sudden Drops (of More Than 50 Percent) for the Average Page Life Expectancy Value |
|
|
483 | (1) |
|
Rule 3: Make Sure You Have Less Than One Memory Grant Pending |
|
|
484 | (1) |
|
Additional Signs of Memory Problems |
|
|
484 | (1) |
|
Detecting I/O Performance Problems |
|
|
485 | (3) |
|
Rule 1: Look Out for Values Greater Than 20 Milliseconds for the Average Disk Second/Read Performance Counter |
|
|
485 | (1) |
|
Rule 2: Average Disk Writes (Indicated by the Average Disk Sec/Write Counter) Should Be Less Than 20 Milliseconds |
|
|
486 | (1) |
|
Rule 3: A Number of Scan Operations (Full Scans, Range Scans) Greater Than One Requires Further Investigation |
|
|
486 | (1) |
|
Rule 4: The Top Two Wait Type Values Should Not Include I/O Waits |
|
|
486 | (1) |
|
|
487 | (1) |
|
Troubleshooting Blocking Problems |
|
|
488 | (11) |
|
Rule 1: Block Percentage Value Should Be Less Than 2 |
|
|
488 | (1) |
|
Rule 2: Investigate Locking Problems If the Block Process Report Displays Blocks Longer Than 30 Seconds |
|
|
489 | (3) |
|
Rule 3: The Average Row Lock Waits Value Should Be Less Than 100 Milliseconds |
|
|
492 | (1) |
|
Rule 4: The Top Two Wait Type Values Should Not Include Locking-Related Waits |
|
|
493 | (1) |
|
Using the Dedicated Administrator Connection to Solve Blocking Problems |
|
|
494 | (5) |
|
Additional Performance Factors |
|
|
499 | (1) |
|
|
499 | (1) |
|
|
500 | (1) |
|
|
501 | (5) |
|
Answers to Review Questions |
|
|
506 | (3) |
|
|
509 | (52) |
|
Picking the Right Data Type |
|
|
510 | (10) |
|
Understanding Your Data Type Options |
|
|
511 | (5) |
|
|
516 | (2) |
|
|
518 | (2) |
|
Optimizing Tables, Indexes, Extents, Pages, and Records |
|
|
520 | (1) |
|
Improving Performance through Database Design |
|
|
521 | (28) |
|
Online Transaction Processing versus Online Analytical Processing |
|
|
521 | (1) |
|
Understanding Normalization |
|
|
522 | (3) |
|
Understanding Denormalization |
|
|
525 | (4) |
|
Creating the Smallest Rows Possible |
|
|
529 | (1) |
|
Using Variable-Length Columns Properly |
|
|
530 | (4) |
|
|
534 | (1) |
|
Moving beyond the 8KB Row Size Limits |
|
|
535 | (1) |
|
Using the VARCHAR(MAX), NVARCHAR(MAX), and VARBINARY(MAX) Data Types |
|
|
536 | (5) |
|
Storing the Large Value Data Types |
|
|
541 | (4) |
|
Understanding the Row-Overflow Data |
|
|
545 | (4) |
|
|
549 | (1) |
|
|
549 | (2) |
|
|
551 | (6) |
|
Answers to Review Questions |
|
|
557 | (4) |
|
|
561 | (28) |
|
Case Study 1: Sequel Search |
|
|
563 | (2) |
|
|
563 | (1) |
|
|
563 | (1) |
|
|
564 | (1) |
|
|
565 | (3) |
|
Answers to Review Questions |
|
|
568 | (2) |
|
|
570 | (1) |
|
|
570 | (1) |
|
|
570 | (1) |
|
|
570 | (1) |
|
|
571 | (3) |
|
Answers to Review Questions |
|
|
574 | (1) |
|
Case Study 3: Sequel Sails |
|
|
575 | (2) |
|
|
575 | (1) |
|
|
575 | (1) |
|
|
576 | (1) |
|
|
577 | (3) |
|
Answers to Review Questions |
|
|
580 | (2) |
|
Case Study 4: Holly Culture |
|
|
582 | (2) |
|
|
582 | (1) |
|
|
582 | (1) |
|
|
583 | (1) |
|
|
584 | (3) |
|
Answers to Review Questions |
|
|
587 | (2) |
Glossary |
|
589 | (14) |
Index |
|
603 | |